Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Trofimov
2012-07-25 13:47:05 +02:00
131 changed files with 4172 additions and 3941 deletions
Binary file not shown.
Binary file not shown.
@@ -1,27 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.debugger.impl.GenericDebuggerParametersRunnerConfigurable">
<grid id="a1cd4" binding="myPanel" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="a1cd4" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="53" y="171" width="441" height="78"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
<xy x="53" y="171" width="441" height="92"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="86bed" binding="myShMemPanel" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="86bed" binding="myShMemPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="0" y="29" width="275" height="22"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="9f41f" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="3" width="138" height="16"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="label.generic.debugger.parameters.patcher.configurable.shmem.address"/>
@@ -29,8 +26,7 @@
</component>
<component id="af504" class="javax.swing.JTextField" binding="myAddressField">
<constraints>
<xy x="148" y="0" width="127" height="22"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="1">
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@@ -40,19 +36,17 @@
</component>
</children>
</grid>
<grid id="c2b5" binding="myPortPanel" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="c2b5" binding="myPortPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="0" y="56" width="275" height="22"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="6e48a" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="3" width="29" height="16"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="label.generic.debugger.parameters.patcher.configurable.port"/>
@@ -60,8 +54,7 @@
</component>
<component id="5ffe7" class="javax.swing.JTextField" binding="myPortField">
<constraints>
<xy x="39" y="0" width="236" height="22"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="1">
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@@ -73,26 +66,23 @@
</grid>
<component id="aad8d" class="javax.swing.JButton" binding="myDebuggerSettings">
<constraints>
<xy x="285" y="40" width="156" height="26"/>
<grid row="1" column="1" row-span="2" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
<grid row="1" column="1" row-span="2" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="button.debugger.settings"/>
</properties>
</component>
<grid id="b10c7" binding="myTransportPanel" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="b10c7" binding="myTransportPanel" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="0" y="0" width="441" height="24"/>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="63d09" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="4" width="62" height="16"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="label.generic.debugger.parameters.patcher.configurable.transport"/>
@@ -100,8 +90,7 @@
</component>
<component id="f3bb4" class="javax.swing.JRadioButton" binding="mySocketTransport">
<constraints>
<xy x="72" y="0" width="64" height="24"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
@@ -110,8 +99,7 @@
</component>
<component id="3bb61" class="javax.swing.JRadioButton" binding="myShmemTransport">
<constraints>
<xy x="146" y="0" width="116" height="24"/>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0"/>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="label.generic.debugger.parameters.patcher.configurable.shmem"/>
@@ -119,8 +107,7 @@
</component>
<hspacer id="b3e0f">
<constraints>
<xy x="262" y="6" width="179" height="11"/>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1"/>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
@@ -107,7 +107,7 @@ public class JavaCompletionContributor extends CompletionContributor {
@Nullable
public static ElementFilter getReferenceFilter(PsiElement position) {
// Completion after extends in interface, type parameter and implements in class
final PsiClass containingClass = PsiTreeUtil.getParentOfType(position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class, PsiVariable.class);
final PsiClass containingClass = PsiTreeUtil.getParentOfType(position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class, PsiVariable.class, PsiAnnotation.class);
if (containingClass != null && psiElement().afterLeaf(PsiKeyword.EXTENDS, PsiKeyword.IMPLEMENTS, ",", "&").accepts(position)) {
return new AndFilter(ElementClassFilter.CLASS, new NotFilter(new AssignableFromContextFilter()));
}
@@ -30,6 +30,9 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import static com.intellij.patterns.PsiJavaPatterns.psiClass;
import static com.intellij.patterns.PsiJavaPatterns.psiElement;
/**
* @author peter
*/
@@ -37,17 +40,24 @@ public class JavaNoVariantsDelegator extends CompletionContributor {
@Override
public void fillCompletionVariants(final CompletionParameters parameters, final CompletionResultSet result) {
final boolean empty = containsOnlyPackages(result.runRemainingContributors(parameters, true));
final boolean empty = containsOnlyPackages(result.runRemainingContributors(parameters, true)) ||
suggestMetaAnnotations(parameters);
if (!empty && parameters.getInvocationCount() == 0) {
result.restartCompletionWhenNothingMatches();
}
if (empty) {
delegate(parameters, result);
delegate(parameters, JavaCompletionSorting.addJavaSorting(parameters, result));
}
}
private static boolean suggestMetaAnnotations(CompletionParameters parameters) {
PsiElement position = parameters.getPosition();
return psiElement().withParents(PsiJavaCodeReferenceElement.class, PsiAnnotation.class, PsiModifierList.class, PsiClass.class).accepts( position) &&
psiElement().withSuperParent(4, psiClass().isAnnotationType()).accepts(position);
}
public static boolean containsOnlyPackages(LinkedHashSet<CompletionResult> results) {
for (CompletionResult result : results) {
if (!(CompletionUtil.getTargetElement(result.getLookupElement()) instanceof PsiPackage)) {
@@ -152,7 +162,7 @@ public class JavaNoVariantsDelegator extends CompletionContributor {
final ClassByNameMerger merger = new ClassByNameMerger(parameters.getInvocationCount() == 0, result);
JavaClassNameCompletionContributor.addAllClasses(parameters,
true, JavaCompletionSorting.addJavaSorting(parameters, result).getPrefixMatcher(), new Consumer<LookupElement>() {
true, result.getPrefixMatcher(), new Consumer<LookupElement>() {
@Override
public void consume(LookupElement element) {
JavaPsiClassReferenceElement classElement = element.as(JavaPsiClassReferenceElement.CLASS_CONDITION_KEY);
@@ -1496,7 +1496,7 @@ public class JavaDocInfoGenerator {
@SuppressWarnings({"HardCodedStringLiteral"})
public static int generateType(StringBuilder buffer, PsiType type, PsiElement context, boolean generateLink) {
if (type instanceof PsiPrimitiveType) {
String text = type.getCanonicalText();
String text = StringUtil.escapeXml(type.getCanonicalText());
buffer.append(text);
return text.length();
}
@@ -1539,7 +1539,7 @@ public class JavaDocInfoGenerator {
PsiSubstitutor psiSubst = result.getSubstitutor();
if (psiClass == null) {
String text = "<font color=red>" + type.getCanonicalText() + "</font>";
String text = "<font color=red>" + StringUtil.escapeXml(type.getCanonicalText()) + "</font>";
buffer.append(text);
return text.length();
}
@@ -1547,7 +1547,7 @@ public class JavaDocInfoGenerator {
String qName = psiClass.getQualifiedName();
if (qName == null || psiClass instanceof PsiTypeParameter) {
String text = type.getCanonicalText();
String text = StringUtil.escapeXml(type.getCanonicalText());
buffer.append(text);
return text.length();
}
@@ -1596,7 +1596,7 @@ public class JavaDocInfoGenerator {
if (type instanceof PsiDisjunctionType) {
if (!generateLink) {
final String text = type.getCanonicalText();
final String text = StringUtil.escapeXml(type.getCanonicalText());
buffer.append(text);
return text.length();
}
@@ -21,7 +21,8 @@ import com.intellij.analysis.JavaAnalysisScope;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.psi.*;
@@ -49,7 +50,8 @@ public class CyclicDependenciesAction extends AnAction{
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
presentation.setEnabled(
getInspectionScope(event.getDataContext()) != null || event.getData(LangDataKeys.PSI_FILE) != null);
getInspectionScope(event.getDataContext()) != null ||
event.getData(PlatformDataKeys.PROJECT) != null);
}
public void actionPerformed(AnActionEvent e) {
@@ -57,15 +59,11 @@ public class CyclicDependenciesAction extends AnAction{
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
final Module module = LangDataKeys.MODULE.getData(dataContext);
if (project != null) {
PsiFile psiFile = LangDataKeys.PSI_FILE.getData(dataContext);
if (psiFile != null && !(psiFile instanceof PsiJavaFile)) {
return;
}
AnalysisScope scope = getInspectionScope(dataContext);
if (scope == null || scope.getScopeType() != AnalysisScope.MODULES){
ProjectModuleOrPackageDialog dlg = null;
if (module != null) {
dlg = new ProjectModuleOrPackageDialog(ModuleUtil.getModuleNameInReadAction(module), scope);
dlg = new ProjectModuleOrPackageDialog(ModuleManager.getInstance(project).getModules().length == 1 ? null : ModuleUtilCore.getModuleNameInReadAction(module), scope);
dlg.show();
if (!dlg.isOK()) return;
}
@@ -104,12 +102,12 @@ public class CyclicDependenciesAction extends AnAction{
//Possible scopes: package, project, module.
Project projectContext = PlatformDataKeys.PROJECT_CONTEXT.getData(dataContext);
if (projectContext != null) {
return new AnalysisScope(projectContext);
return null;
}
Module moduleContext = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
if (moduleContext != null) {
return new AnalysisScope(moduleContext);
return null;
}
Module [] modulesArray = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext);
@@ -128,12 +126,9 @@ public class CyclicDependenciesAction extends AnAction{
PsiDirectory[] dirs = pack.getDirectories(GlobalSearchScope.projectScope(pack.getProject()));
if (dirs.length == 0) return null;
return new JavaAnalysisScope(pack, LangDataKeys.MODULE.getData(dataContext));
} else if (psiTarget != null){
return null;
}
return getProjectScope(dataContext);
return null;
}
@Nullable
@@ -173,7 +168,6 @@ public class CyclicDependenciesAction extends AnAction{
init();
setTitle(AnalysisScopeBundle.message("cyclic.dependencies.scope.dialog.title", myTitle));
setHorizontalStretch(1.75f);
myModuleButton.setSelected(true);
}
public boolean isIncludeTestSources() {
@@ -190,11 +184,19 @@ public class CyclicDependenciesAction extends AnAction{
myModuleButton.setText(AnalysisScopeBundle.message("cyclic.dependencies.scope.dialog.module.button", myAnalysisVerb, myModuleName));
group.add(myModuleButton);
}
myModuleButton.setVisible(myModuleName != null);
mySelectedScopeButton.setVisible(mySelectedScope != null);
if (mySelectedScope != null) {
mySelectedScopeButton.setText(mySelectedScope.getShortenName());
group.add(mySelectedScopeButton);
}
if (mySelectedScope != null) {
mySelectedScopeButton.setSelected(true);
} else if (myModuleName != null) {
myModuleButton.setSelected(true);
} else {
myProjectButton.setSelected(true);
}
return myWholePanel;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -72,26 +72,25 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
@Override
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
String navigateInfo = null;
if (element instanceof PsiClass) {
navigateInfo = generateClassInfo((PsiClass)element);
return generateClassInfo((PsiClass)element);
}
else if (element instanceof PsiMethod) {
navigateInfo = generateMethodInfo((PsiMethod)element, calcSubstitutor(originalElement));
return generateMethodInfo((PsiMethod)element, calcSubstitutor(originalElement));
}
else if (element instanceof PsiField) {
navigateInfo = generateFieldInfo((PsiField)element, calcSubstitutor(originalElement));
return generateFieldInfo((PsiField)element, calcSubstitutor(originalElement));
}
else if (element instanceof PsiVariable) {
navigateInfo = generateVariableInfo((PsiVariable)element);
return generateVariableInfo((PsiVariable)element);
}
else if (element instanceof PsiPackage) {
navigateInfo = generatePackageInfo((PsiPackage)element);
return generatePackageInfo((PsiPackage)element);
}
else if (element instanceof BeanPropertyElement) {
navigateInfo = generateMethodInfo(((BeanPropertyElement) element).getMethod(), PsiSubstitutor.EMPTY);
return generateMethodInfo(((BeanPropertyElement) element).getMethod(), PsiSubstitutor.EMPTY);
}
return StringUtil.escapeXml(StringUtil.unescapeXml(navigateInfo));
return null;
}
private static PsiSubstitutor calcSubstitutor(PsiElement originalElement) {
@@ -196,10 +196,12 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
if (value != null && !(value instanceof PsiCallExpression)) {
for (UsageInfo info : usagesIn) {
PsiReference reference = info.getReference();
InlineUtil.TailCallType type = InlineUtil.getTailCallType(reference);
if (type == InlineUtil.TailCallType.Simple) {
conflicts.putValue(statement, "Inlined result won't be a valid statement");
break;
if (reference != null) {
InlineUtil.TailCallType type = InlineUtil.getTailCallType(reference);
if (type == InlineUtil.TailCallType.Simple) {
conflicts.putValue(statement, "Inlined result won't be a valid statement");
break;
}
}
}
}
@@ -30,6 +30,7 @@ import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -276,7 +277,7 @@ public class InlineUtil {
return result && nonTailCallUsages.isEmpty();
}
public static TailCallType getTailCallType(final PsiReference psiReference) {
public static TailCallType getTailCallType(@NotNull final PsiReference psiReference) {
PsiElement element = psiReference.getElement();
PsiExpression methodCall = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class);
if (methodCall == null) return TailCallType.None;
@@ -15,7 +15,7 @@
*/
package com.intellij.psi.impl;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.java.stubs.index.JavaFieldNameIndex;
@@ -42,7 +42,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
class PsiShortNamesCacheImpl extends PsiShortNamesCache {
public class PsiShortNamesCacheImpl extends PsiShortNamesCache {
private final PsiManagerEx myManager;
public PsiShortNamesCacheImpl(PsiManagerEx manager) {
@@ -225,7 +225,7 @@ class PsiShortNamesCacheImpl extends PsiShortNamesCache {
});
for (T member : members) {
ProgressManager.checkCanceled();
ProgressIndicatorProvider.checkCanceled();
if (!scope.contains(member.getContainingFile().getVirtualFile())) continue;
if (!set.add(member)) continue;
@@ -117,7 +117,8 @@ public class LambdaUtil {
final int parameterIndex = ((PsiParameterList)paramParent).getParameterIndex(param);
if (parameterIndex > -1) {
final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(param, PsiLambdaExpression.class);
final PsiClassType.ClassResolveResult resolveResult = getFunctionInterfaceType(lambdaExpression);
final PsiType type = getFunctionInterfaceType(lambdaExpression);
final PsiClassType.ClassResolveResult resolveResult = type instanceof PsiClassType ? ((PsiClassType)type).resolveGenerics() : null;
if (resolveResult != null) {
final MethodSignature methodSignature = getFunction(resolveResult.getElement());
if (methodSignature != null) {
@@ -140,7 +141,7 @@ public class LambdaUtil {
}
@Nullable
public static PsiClassType.ClassResolveResult getFunctionInterfaceType(@Nullable PsiLambdaExpression lambdaExpression) {
public static PsiType getFunctionInterfaceType(@Nullable PsiLambdaExpression lambdaExpression) {
if (lambdaExpression != null) {
final PsiElement parent = lambdaExpression.getParent();
PsiType type = null;
@@ -177,10 +178,7 @@ public class LambdaUtil {
type = method.getReturnType();
}
}
if (type instanceof PsiClassType) {
return ((PsiClassType)type).resolveGenerics();
}
return type;
}
return null;
}
@@ -57,7 +57,7 @@ public class PsiLambdaExpressionType extends PsiType {
@Override
public <A> A accept(@NotNull final PsiTypeVisitor<A> visitor) {
return visitor.visitType(this);
return visitor.visitLambdaExpressionType(this);
}
@Override
@@ -67,4 +67,9 @@ public class PsiTypeVisitor<A> {
public A visitDiamondType(PsiDiamondType diamondType) {
return visitType(diamondType);
}
@Nullable
public A visitLambdaExpressionType(PsiLambdaExpressionType lambdaExpressionType) {
return visitType(LambdaUtil.getFunctionInterfaceType(lambdaExpressionType.getExpression()));
}
}
@@ -75,8 +75,9 @@ public class CoreJavaFileManager implements JavaFileManager {
final VirtualFile file = dir.getVirtualFile();
for (VirtualFile root : myClasspath) {
if (VfsUtilCore.isAncestor(root, file, false)) {
final String relativePath = FileUtil.getRelativePath(root.getPath(), file.getPath(), '.');
return new PsiPackageImpl(myPsiManager, relativePath);
String relativePath = FileUtil.getRelativePath(root.getPath(), file.getPath(), '/');
if (relativePath == null) continue;
return new PsiPackageImpl(myPsiManager, relativePath.replace('/', '.'));
}
}
return null;
@@ -1446,6 +1446,12 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
finishElement(expression);
}
@Override
public void visitLambdaExpression(PsiLambdaExpression expression) {
startElement(expression);
finishElement(expression);
}
@Override public void visitMethodCallExpression(PsiMethodCallExpression expression) {
startElement(expression);
@@ -0,0 +1,8 @@
public final class FileAttributes {
public static final int SYM_LINK = 0x01;
public static final int BROKEN_SYM_LINK = 0x02;
public static final int HIDDEN = 0x20;
@MagicConstant(flags = {SYM_LINK, BROK<caret>, HIDDEN})
public @interface Flags { }
}
@@ -0,0 +1,8 @@
public final class FileAttributes {
public static final int SYM_LINK = 0x01;
public static final int BROKEN_SYM_LINK = 0x02;
public static final int HIDDEN = 0x20;
@MagicConstant(flags = {SYM_LINK, BROKEN_SYM_LINK<caret>, HIDDEN})
public @interface Flags { }
}
@@ -1,12 +1,2 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Z<caret>
@interface Foo {
}
@Target({ElementType.ANNOTATION_TYPE})
@interface ZMetaAnno {}
@Target({ElementType.LOCAL_VARIABLE})
@interface ZLocalAnno {}
@T<caret>
@interface Foo { }
@@ -0,0 +1,11 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
void test() {
SAM<Integer> c = (i, j)->i + j;
m(<caret>c);
}
void m(SAM<Integer> s) { }
}
@@ -0,0 +1,10 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
void test() {
m((i, j)->i + j);
}
void m(SAM<Integer> s) { }
}
@@ -1,12 +1,12 @@
public class Derr {
public static final Long ONE = new Long(1);
public static final Long LONGONE = new Long(1);
public static void main(String[] args) {
long value;
value = ONE;
value = ONE;
value = ONE;
value = LONGONE;
value = LONGONE;
value = LONGONE;
}
}
@@ -3,7 +3,7 @@ class Test {
private final String string;
Test() {
<caret>string = "";
string = "";<caret>
myTimer = string;
}
}
@@ -1,6 +1,6 @@
public class Aaa {
public String method(String string) {
return string + string + string;
public String method(String stringstring) {
return stringstring + stringstring + stringstring;
}
public String getString() {
@@ -0,0 +1,14 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
public final int anInt = 0;
void test() {
m((i, j) -> {
return i + j;
});
}
void m(SAM<Integer> s) { }
}
@@ -0,0 +1,13 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
void test() {
m((i, j) -> {
<selection>0</selection>
return i + j;
});
}
void m(SAM<Integer> s) { }
}
@@ -0,0 +1,11 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
void test() {
SAM<Integer> c = (i, j)->i + j;
m(c);
}
void m(SAM<Integer> s) { }
}
@@ -0,0 +1,10 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
void test() {
m(<selection>(i, j) -> i + j</selection>);
}
void m(SAM<Integer> s) { }
}
@@ -0,0 +1,11 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
void test() {
SAM<Integer> c = (i, j)->"" + i + j;
SAM<Integer> s3 = m(c);
}
<X> SAM<X> m(SAM<X> s) { return null; }
}
@@ -0,0 +1,10 @@
interface SAM<X> {
X m(int i, int j);
}
class Foo {
void test() {
SAM<Integer> s3 = m(<selection>(i, j) -> "" + i + j</selection>);
}
<X> SAM<X> m(SAM<X> s) { return null; }
}
@@ -343,7 +343,16 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
}
public void testPreferApplicableAnnotations() throws Throwable {
checkPreferredItems 0, 'ZMetaAnno', 'ZLocalAnno'
myFixture.addClass '''
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target({ElementType.ANNOTATION_TYPE})
@interface TMetaAnno {}
@Target({ElementType.LOCAL_VARIABLE})
@interface TLocalAnno {}'''
checkPreferredItems 0, 'TMetaAnno', 'Target', 'TreeSelectionMode', 'TLocalAnno'
}
public void testJComponentAddNewWithStats() throws Throwable {
@@ -1293,6 +1293,8 @@ public class ListUtils {
public void testPackageInMemberType() { doTest() }
public void testConstantInAnno() { doTest() }
public void testClassNameDot() { doTest('.') }
public void testClassNameDotBeforeCall() {
@@ -118,6 +118,12 @@ public class IntroduceFieldInSameClassTest extends LightCodeInsightTestCase {
performRefactoring(BaseExpressionToFieldHandler.InitializationPlace.IN_FIELD_DECLARATION, false);
checkResultByFile("/refactoring/introduceField/afterLocalVarAnnotations.java");
}
public void testFromLambdaExpr() throws Exception {
configureByFile("/refactoring/introduceField/beforeFromLambdaExpr.java");
performRefactoring(BaseExpressionToFieldHandler.InitializationPlace.IN_FIELD_DECLARATION, false);
checkResultByFile("/refactoring/introduceField/afterFromLambdaExpr.java");
}
public void testStaticFieldInInnerClass() throws Exception {
configureByFile("/refactoring/introduceField/beforeStaticFieldInInnerClass.java");
@@ -335,6 +335,14 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
doTest(new MockIntroduceVariableHandler("c", false, false, false, CommonClassNames.JAVA_LANG_OBJECT));
}
public void testLambdaExpr() throws Exception {
doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.Integer>"));
}
public void testLambdaExprNotAccepted() throws Exception {
doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.Integer>"));
}
private void doTest(IntroduceVariableBase testMe) throws Exception {
@NonNls String baseName = "/refactoring/introduceVariable/" + getTestName(false);
configureByFile(baseName + ".java");
@@ -136,6 +136,10 @@ public class InlineLocalTest extends LightCodeInsightTestCase {
doTest(false, "Cannot perform refactoring.\n" +
"Variable 'x' is accessed for writing.");
}
public void testLambdaExpr() throws Exception {
doTest(true);
}
private void doTest(final boolean inlineDef, String conflictMessage) throws Exception {
try {
@@ -33,7 +33,7 @@ public class ArtifactState {
@NonNls public static final String NAME_ATTRIBUTE = "name";
private String myName;
private String myOutputPath;
private String myArtifactType;
private String myArtifactType = "plain";
private boolean myBuildOnMake;
private Element myRootElement;
private List<ArtifactPropertiesState> myPropertiesList = new ArrayList<ArtifactPropertiesState>();
+27 -24
View File
@@ -23,6 +23,8 @@ static jfieldID attributesID = NULL;
static jfieldID timestampID = NULL;
static jfieldID lengthID = NULL;
#define BROKEN_SYMLINK_ATTR -1
static jclass getFileInfoClass(JNIEnv *env) {
return env->FindClass("com/intellij/openapi/util/io/win32/FileInfo");
}
@@ -54,23 +56,18 @@ static inline LONGLONG pairToInt64(DWORD lowPart, DWORD highPart) {
#define FILE_SHARE_ATTRIBUTES (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE)
static jobject CreateFileInfo(JNIEnv *env, jstring path, bool append, LPWIN32_FIND_DATA lpData, jclass fileInfoClass) {
jobject o = env->AllocObject(fileInfoClass);
if (o == NULL) {
return NULL;
}
DWORD attributes = lpData->dwFileAttributes;
LONGLONG timestamp = pairToInt64(lpData->ftLastWriteTime.dwLowDateTime, lpData->ftLastWriteTime.dwHighDateTime);
LONGLONG length = pairToInt64(lpData->nFileSizeLow, lpData->nFileSizeHigh);
jstring fileName = env->NewString((jchar*)lpData->cFileName, (jsize)wcslen(lpData->cFileName));
if (fileName == NULL) {
return NULL;
}
env->SetObjectField(o, nameID, fileName);
bool read = false;
if (IS_SET(lpData->dwFileAttributes, FILE_ATTRIBUTE_REPARSE_POINT)) {
if (IS_SET(attributes, FILE_ATTRIBUTE_REPARSE_POINT)) {
if (IS_SET(lpData->dwReserved0, IO_REPARSE_TAG_SYMLINK)) {
attributes = BROKEN_SYMLINK_ATTR;
timestamp = 0;
length = 0;
size_t nameLen = env->GetStringLength(path) + wcslen(lpData->cFileName) + 2;
wchar_t *lpName = (wchar_t *)malloc(nameLen * sizeof(wchar_t));
if (lpName != NULL) {
const jchar *dirName = env->GetStringChars(path, 0);
wcscpy_s(lpName, nameLen, (LPCWSTR)dirName);
@@ -85,29 +82,35 @@ static jobject CreateFileInfo(JNIEnv *env, jstring path, bool append, LPWIN32_FI
if (th != INVALID_HANDLE_VALUE) {
BY_HANDLE_FILE_INFORMATION targetData;
if (GetFileInformationByHandle(th, &targetData)) {
targetData.dwFileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
env->SetIntField(o, attributesID, targetData.dwFileAttributes);
env->SetLongField(o, timestampID, pairToInt64(targetData.ftLastWriteTime.dwLowDateTime, targetData.ftLastWriteTime.dwHighDateTime));
env->SetLongField(o, lengthID, pairToInt64(targetData.nFileSizeLow, targetData.nFileSizeHigh));
read = true;
attributes = targetData.dwFileAttributes | FILE_ATTRIBUTE_REPARSE_POINT;
timestamp = pairToInt64(targetData.ftLastWriteTime.dwLowDateTime, targetData.ftLastWriteTime.dwHighDateTime);
length = pairToInt64(targetData.nFileSizeLow, targetData.nFileSizeHigh);
}
CloseHandle(th);
}
free(lpName);
}
}
else {
lpData->dwFileAttributes &= (~ FILE_ATTRIBUTE_REPARSE_POINT); // keep reparse flag only for symlinks
attributes &= (~ FILE_ATTRIBUTE_REPARSE_POINT); // keep reparse flag only for symlinks
}
}
if (!read) {
env->SetIntField(o, attributesID, lpData->dwFileAttributes);
env->SetLongField(o, timestampID, pairToInt64(lpData->ftLastWriteTime.dwLowDateTime, lpData->ftLastWriteTime.dwHighDateTime));
env->SetLongField(o, lengthID, pairToInt64(lpData->nFileSizeLow, lpData->nFileSizeHigh));
jobject o = env->AllocObject(fileInfoClass);
if (o == NULL) {
return NULL;
}
jstring fileName = env->NewString((jchar*)lpData->cFileName, (jsize)wcslen(lpData->cFileName));
if (fileName == NULL) {
return NULL;
}
env->SetObjectField(o, nameID, fileName);
env->SetIntField(o, attributesID, attributes);
env->SetLongField(o, timestampID, timestamp);
env->SetLongField(o, lengthID, length);
return o;
}
+9
View File
@@ -0,0 +1,9 @@
Prerequisites:
- Visual Studio C++ 2010 Express
- Windows SDK 7.1 (native: Windows Headers, x86 Libraries, x64 Libraries, Tools, Visual C++ Compilers)
- JDK 1.6+
To build:
- open Property Manager, expand any configuration, open IdeaWin32 property page, and edit JAVA_HOME user macro
to point to a valid JDK installation
- build Release/Win32 and Release/x64 configurations
@@ -258,6 +258,7 @@ public class CoreApplicationEnvironment {
});
}
public static <T> void registerExtensionPoint(final ExtensionsArea area, final ExtensionPointName<T> extensionPointName,
final Class<? extends T> aClass) {
final String name = extensionPointName.getName();
@@ -20,10 +20,12 @@ import com.intellij.mock.MockFileIndexFacade;
import com.intellij.mock.MockProject;
import com.intellij.mock.MockResolveScopeManager;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Disposer;
import com.intellij.psi.PsiFileFactory;
import com.intellij.psi.PsiManager;
import com.intellij.psi.impl.*;
@@ -96,6 +98,18 @@ public class CoreProjectEnvironment {
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getArea(myProject), extensionPointName, aClass);
}
protected <T> void addProjectExtension(final ExtensionPointName<T> name, final T extension) {
final ExtensionPoint<T> extensionPoint = Extensions.getArea(myProject).getExtensionPoint(name);
extensionPoint.registerExtension(extension);
Disposer.register(myParentDisposable, new Disposable() {
@Override
public void dispose() {
extensionPoint.unregisterExtension(extension);
}
});
}
public <T> void registerProjectComponent(final Class<T> interfaceClass, final T implementation) {
CoreApplicationEnvironment.registerComponentInstance(myProject.getPicoContainer(), interfaceClass, implementation);
}
@@ -32,6 +32,6 @@ public class ForeignLeafType extends TokenWrapper implements ILeafElementType {
@Override
@NotNull
public ASTNode createLeafNode(CharSequence leafText) {
return new ForeignLeafPsiElement(getDelegate(), getValue());
return new ForeignLeafPsiElement(this, getValue());
}
}
@@ -1367,15 +1367,13 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder, AS
return ourAnyLanguageWhitespaceTokens.contains(n2.getTokenType()) ||
n2 instanceof Token && ((Token)n2).myBuilder.myWhitespaces.contains(n2.getTokenType());
}
IElementType n1t;
if (n1 instanceof ForeignLeafPsiElement)
n1t = ((ForeignLeafPsiElement)n1).getForeignType();
else
n1t = n1.getElementType();
return dereferenceToken(n1.getElementType()) == dereferenceToken(n2.getTokenType());
}
public static IElementType dereferenceToken(IElementType probablyWrapper) {
if (probablyWrapper instanceof TokenWrapper) {
return dereferenceToken(((TokenWrapper)probablyWrapper).getDelegate());
}
return probablyWrapper;
return Comparing.equal(n1t, n2.getTokenType());
}
@Override
@@ -126,7 +126,7 @@ public class CoreLocalVirtualFile extends VirtualFile {
@Override
public InputStream getInputStream() throws IOException {
return VfsUtilCore.inputStreamSkippingBOM(new FileInputStream(myIoFile), this);
return VfsUtilCore.inputStreamSkippingBOM(new BufferedInputStream(new FileInputStream(myIoFile)), this);
}
@Override
@@ -19,13 +19,25 @@
*/
package com.intellij.psi.impl.source.tree;
import com.intellij.lang.ForeignLeafType;
import com.intellij.lang.TokenWrapper;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
public class ForeignLeafPsiElement extends LeafPsiElement {
public ForeignLeafPsiElement(IElementType type, CharSequence text) {
super(type, text);
private ForeignLeafType myForeignType;
public ForeignLeafPsiElement(ForeignLeafType type, CharSequence text) {
super(dereferenceElementType(type.getDelegate()), text);
myForeignType = type;
}
private static IElementType dereferenceElementType(IElementType type) {
while ( type instanceof TokenWrapper)
type = (( TokenWrapper ) type ).getDelegate();
return type;
}
@Override
@@ -63,6 +75,10 @@ public class ForeignLeafPsiElement extends LeafPsiElement {
return 0;
}
public ForeignLeafType getForeignType() {
return myForeignType;
}
@Override
public String toString() {
return "ForeignLeaf(" + getElementType() + ": " + getText() + ")";
@@ -198,7 +198,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
assert !myDisposed;
Application application = ApplicationManager.getApplication();
application.assertIsDispatchThread();
assert !application.isWriteAccessAllowed();
assert !application.isWriteAccessAllowed() : "Write access is required";
// pump first so that queued event do not interfere
UIUtil.dispatchAllInvocationEvents();
@@ -155,6 +155,7 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
final Boolean value = ((IndentedCommenter)commenter).forceIndentedLineComment();
if (value != null && value == Boolean.TRUE) {
selectionStart = myDocument.getLineStartOffset(myDocument.getLineNumber(selectionStart));
selectionEnd = myDocument.getLineEndOffset(myDocument.getLineNumber(selectionEnd));
}
}
commentRange(selectionStart, selectionEnd, prefix, suffix, commenter);
@@ -162,6 +163,16 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler {
else {
EditorUtil.fillVirtualSpaceUntilCaret(editor);
int caretOffset = myEditor.getCaretModel().getOffset();
if (commenter instanceof IndentedCommenter) {
final Boolean value = ((IndentedCommenter)commenter).forceIndentedLineComment();
if (value != null && value == Boolean.TRUE) {
final int lineNumber = myDocument.getLineNumber(caretOffset);
final int start = myDocument.getLineStartOffset(lineNumber);
final int end = myDocument.getLineEndOffset(lineNumber);
commentRange(start, end, prefix, suffix, commenter);
return;
}
}
myDocument.insertString(caretOffset, prefix + suffix);
myEditor.getCaretModel().moveToOffset(caretOffset + prefix.length());
}
@@ -43,6 +43,7 @@ import com.intellij.openapi.editor.ex.ScrollingModelEx;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -230,6 +231,9 @@ public class LookupTypedHandler extends TypedHandlerDelegate {
}
static CharFilter.Result getLookupAction(final char charTyped, final LookupImpl lookup) {
if (!Registry.is("ide.completion.allow.finishing.by.chars")) {
return CharFilter.Result.ADD_TO_PREFIX;
}
final CharFilter.Result filtersDecision = getFiltersDecision(charTyped, lookup);
final LookupElement currentItem = lookup.getCurrentItem();
@@ -249,7 +253,9 @@ public class LookupTypedHandler extends TypedHandlerDelegate {
}
}
if (filtersDecision != null) return filtersDecision;
if (filtersDecision != null) {
return filtersDecision;
}
throw new AssertionError("Typed char not handler by char filter: c=" + charTyped +
"; prefix=" + currentItem +
"; filters=" + Arrays.toString(getFilters()));
@@ -191,6 +191,10 @@ public class DocPreviewUtil {
// We don't want to perform the replacement then.
continue;
}
if (end - i > 1 && i > 0 && !ALLOWED_LINK_SEPARATORS.contains(text.charAt(i - 1))) {
// Similar situation but targets head match: from = 'TextRange', text = 'getTextRange()'.
continue;
}
text.replace(i, end, replaceTo);
int diff = replaceTo.length() - replaceFrom.length();
for (int j = 0; j < readOnlyChanges.size(); j++) {
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.impl.ConfigurationSettingsEditor.RunnersEditorComponent" stored-main-component-binding="myWholePanel">
<grid id="4be0c" binding="myRunnersPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="4be0c" binding="myRunnersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="151" y="101" width="295" height="128"/>
@@ -10,8 +10,8 @@
<children>
<scrollpane id="baa95" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="2" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="120" height="-1"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="50"/>
</grid>
</constraints>
<properties/>
@@ -28,7 +28,7 @@
<xy id="56f2e" binding="myRunnerPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ListScrollingUtil;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.containers.Convertor;
@@ -145,7 +146,9 @@ class ConfigurationSettingsEditor extends CompositeSettingsEditor<RunnerAndConfi
if (wrappedRunEditor != null && wrappedConfigEditor != null) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(wrappedConfigEditor.getComponent(), BorderLayout.CENTER);
panel.add(wrappedRunEditor.getComponent(), BorderLayout.SOUTH);
JComponent wrappedRunEditorComponent = wrappedRunEditor.getComponent();
wrappedRunEditorComponent.setBorder(IdeBorderFactory.createEmptyBorder(3, 0, 0, 0));
panel.add(wrappedRunEditorComponent, BorderLayout.SOUTH);
return panel;
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.impl.ConfigurationSettingsEditorWrapper">
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="5" bottom="0" right="0"/>
<constraints>
<xy x="124" y="274" width="276" height="150"/>
@@ -28,14 +28,6 @@
<border type="etched" title-resource-bundle="messages/ExecutionBundle" title-key="before.launch.panel.title"/>
<children/>
</grid>
<component id="c7b94" class="javax.swing.JCheckBox" binding="myCbStoreProjectConfiguration">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="run.configuration.store.place.option"/>
</properties>
</component>
<vspacer id="6092a">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="0" indent="0" use-parent-layout="false">
@@ -32,8 +32,6 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections;
import java.util.List;
@@ -45,14 +43,11 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor<RunnerAnd
implements BeforeRunStepsPanel.StepsBeforeRunListener {
public static DataKey<ConfigurationSettingsEditorWrapper> CONFIGURATION_EDITOR_KEY = DataKey.create("ConfigurationSettingsEditor");
private JPanel myComponentPlace;
private JCheckBox myCbStoreProjectConfiguration;
private JPanel myWholePanel;
private JPanel myBeforeLaunchContainer;
private BeforeRunStepsPanel myBeforeRunStepsPanel;
private boolean myStoreProjectConfiguration;
private final ConfigurationSettingsEditor myEditor;
public ConfigurationSettingsEditorWrapper(final RunnerAndConfigurationSettings settings) {
@@ -65,21 +60,9 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor<RunnerAnd
private void doReset(RunnerAndConfigurationSettings settings) {
final RunConfiguration runConfiguration = settings.getConfiguration();
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(runConfiguration.getProject());
myBeforeRunStepsPanel.doReset(settings);
myBeforeLaunchContainer.setVisible(!(runConfiguration instanceof UnknownRunConfiguration));
myStoreProjectConfiguration = runManager.isConfigurationShared(settings);
myCbStoreProjectConfiguration.setEnabled(!(runConfiguration instanceof UnknownRunConfiguration));
myCbStoreProjectConfiguration.setSelected(myStoreProjectConfiguration);
myCbStoreProjectConfiguration.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myStoreProjectConfiguration = myCbStoreProjectConfiguration.isSelected();
}
});
myCbStoreProjectConfiguration.setVisible(!settings.isTemplate());
}
@NotNull
@@ -113,7 +96,6 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor<RunnerAnd
final RunConfiguration runConfiguration = settings.getConfiguration();
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(runConfiguration.getProject());
runManager.setBeforeRunTasks(runConfiguration, myBeforeRunStepsPanel.getTasks(true), false);
runManager.shareConfiguration(runConfiguration, myStoreProjectConfiguration);
RunnerAndConfigurationSettings runManagerSettings = runManager.getSettings(runConfiguration);
if (runManagerSettings != null) {
runManagerSettings.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
@@ -128,10 +110,6 @@ public class ConfigurationSettingsEditorWrapper extends SettingsEditor<RunnerAnd
return Collections.unmodifiableList(myBeforeRunStepsPanel.getTasks(true));
}
public boolean isStoreProjectConfiguration() {
return myStoreProjectConfiguration;
}
@Override
public void fireStepsBeforeRunChanged() {
fireEditorStateChanged();
@@ -96,7 +96,7 @@ class RunConfigurable extends BaseConfigurable {
this(project, null);
}
public RunConfigurable(final Project project, final RunDialogBase runDialog) {
public RunConfigurable(final Project project, @Nullable final RunDialogBase runDialog) {
myProject = project;
myRunDialog = runDialog;
}
@@ -183,7 +183,7 @@ class RunConfigurable extends BaseConfigurable {
final ConfigurationType[] factories = manager.getConfigurationFactories();
for (ConfigurationType type : factories) {
final RunnerAndConfigurationSettings[] configurations = manager.getConfigurationSettings(type);
if (configurations != null && configurations.length > 0) {
if (configurations.length > 0) {
final DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(type);
myRoot.add(typeNode);
for (RunnerAndConfigurationSettings configuration : configurations) {
@@ -640,7 +640,6 @@ class RunConfigurable extends BaseConfigurable {
manager.addConfiguration(each.getSettings(), each.isShared(), each.getStepsBeforeLaunch(), false);
}
RunnerAndConfigurationSettings selected = manager.getSelectedConfiguration();
for (RunnerAndConfigurationSettings each : toDeleteSettings) {
manager.removeConfiguration(each);
}
@@ -1181,7 +1180,7 @@ class RunConfigurable extends BaseConfigurable {
RunnerAndConfigurationSettings selectedSettings = getSettings(treeNode);
if (selectedSettings == null)
return;
RunnerAndConfigurationSettings siblingSettings = null;
RunnerAndConfigurationSettings siblingSettings;
if (myDirection < 0) {
siblingSettings = getSettings(treeNode.getPreviousSibling());
} else {
@@ -1228,7 +1227,7 @@ class RunConfigurable extends BaseConfigurable {
myConfigurable = configurable;
mySettings = (RunnerAndConfigurationSettings)myConfigurable.getSettings();
final ConfigurationSettingsEditorWrapper editorWrapper = (ConfigurationSettingsEditorWrapper)myConfigurable.getEditor();
myShared = editorWrapper.isStoreProjectConfiguration();
myShared = configurable.isStoreProjectConfiguration();
myStepsBeforeLaunch = editorWrapper.getStepsBeforeLaunch();
}
File diff suppressed because it is too large Load Diff
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.execution.impl.SingleConfigurationConfigurable.MyValidatableComponent">
<grid id="cae26" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="cae26" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="13" y="24" width="615" height="174"/>
<xy x="13" y="24" width="427" height="174"/>
</constraints>
<properties/>
<border type="none"/>
@@ -11,7 +11,7 @@
<grid id="cd390" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="5" bottom="0" right="0"/>
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -46,14 +46,14 @@
<xy id="49cf" binding="myComponentPlace" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
<grid id="bb10e" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="5" bottom="0" right="0"/>
<grid id="bb10e" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="5" bottom="3" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
@@ -71,20 +71,27 @@
</component>
<component id="4f1db" class="javax.swing.JTextField" binding="myNameText">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="100" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="53321" class="javax.swing.JCheckBox" binding="myCbStoreProjectConfiguration">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ExecutionBundle" key="run.configuration.store.place.option"/>
</properties>
</component>
<hspacer id="e4047">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
<component id="c89fa" class="javax.swing.JSeparator">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>
@@ -49,18 +49,17 @@ public final class SingleConfigurationConfigurable<Config extends RunConfigurati
private MyValidatableComponent myComponent;
private final String myDisplayName;
private final String myHelpTopic;
private final Icon myIcon;
private final boolean myBrokenConfiguration;
private boolean myStoreProjectConfiguration;
private SingleConfigurationConfigurable(RunnerAndConfigurationSettings settings, @Nullable Executor executor) {
super(new ConfigurationSettingsEditorWrapper(settings), settings);
myExecutor = executor;
final Config configuration = (Config)getSettings().getConfiguration();
final Config configuration = getConfiguration();
myDisplayName = getSettings().getName();
myHelpTopic = "reference.dialogs.rundebug." + configuration.getType().getId();
myIcon = configuration.getType().getIcon();
myBrokenConfiguration = configuration instanceof UnknownRunConfiguration;
@@ -87,6 +86,9 @@ public final class SingleConfigurationConfigurable<Config extends RunConfigurati
public void apply() throws ConfigurationException {
RunnerAndConfigurationSettings settings = getSettings();
RunConfiguration runConfiguration = settings.getConfiguration();
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(runConfiguration.getProject());
runManager.shareConfiguration(runConfiguration, myStoreProjectConfiguration);
settings.setName(getNameText());
super.apply();
RunManagerImpl.getInstanceImpl(getConfiguration().getProject()).fireRunConfigurationChanged(settings);
@@ -94,20 +96,24 @@ public final class SingleConfigurationConfigurable<Config extends RunConfigurati
public void reset() {
RunnerAndConfigurationSettings configuration = getSettings();
if (configuration != null) {
setNameText(configuration.getName());
}
setNameText(configuration.getName());
super.reset();
if (myComponent == null) {
myComponent = new MyValidatableComponent();
}
myComponent.doReset(configuration);
}
public final JComponent createComponent() {
if (myComponent == null) {
myComponent = new MyValidatableComponent();
myComponent.myNameText.setEnabled(!myBrokenConfiguration);
}
myComponent.myNameText.setEnabled(!myBrokenConfiguration);
return myComponent.getWholePanel();
}
public boolean isStoreProjectConfiguration() {
return myStoreProjectConfiguration;
}
@Nullable
private ValidationResult getValidationResult() {
if (!myValidationResultValid) {
myLastValidationResult = null;
@@ -212,6 +218,8 @@ public final class SingleConfigurationConfigurable<Config extends RunConfigurati
private JLabel myWarningLabel;
private JButton myFixButton;
private JSeparator mySeparator;
private JCheckBox myCbStoreProjectConfiguration;
private Runnable myQuickFix = null;
public MyValidatableComponent() {
@@ -247,6 +255,21 @@ public final class SingleConfigurationConfigurable<Config extends RunConfigurati
settingAnchor();
}
private void doReset(RunnerAndConfigurationSettings settings) {
final RunConfiguration runConfiguration = settings.getConfiguration();
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(runConfiguration.getProject());
myStoreProjectConfiguration = runManager.isConfigurationShared(settings);
myCbStoreProjectConfiguration.setEnabled(!(runConfiguration instanceof UnknownRunConfiguration));
myCbStoreProjectConfiguration.setSelected(myStoreProjectConfiguration);
myCbStoreProjectConfiguration.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myStoreProjectConfiguration = myCbStoreProjectConfiguration.isSelected();
}
});
myCbStoreProjectConfiguration.setVisible(!settings.isTemplate());
}
private void settingAnchor() {
}
@@ -258,6 +281,7 @@ public final class SingleConfigurationConfigurable<Config extends RunConfigurati
return getEditor().getComponent();
}
@Nullable
public ValidationResult getValidationResult() {
return SingleConfigurationConfigurable.this.getValidationResult();
}
@@ -65,7 +65,12 @@ public class FileTypeIndex extends ScalarIndexExtension<FileType>
@Override
public int getVersion() {
return 1;
FileType[] types = myFileTypeManager.getRegisteredFileTypes();
int version = 1;
for (FileType type : types) {
version += type.getName().hashCode();
}
return version;
}
@Override
@@ -297,6 +297,12 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
}
}
private boolean myShouldSelect = true;
@Override
protected boolean shouldSelectAll() {
return myShouldSelect;
}
public void restartInplaceIntroduceTemplate() {
Runnable restartTemplateRunnable = new Runnable() {
public void run() {
@@ -305,7 +311,13 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
myEditor.putUserData(INTRODUCE_RESTART, true);
try {
templateState.gotoEnd(true);
startInplaceIntroduceTemplate();
try {
myShouldSelect = false;
startInplaceIntroduceTemplate();
}
finally {
myShouldSelect = true;
}
}
finally {
myEditor.putUserData(INTRODUCE_RESTART, false);
@@ -317,6 +329,13 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
CommandProcessor.getInstance().executeCommand(myProject, restartTemplateRunnable, getCommandName(), getCommandName());
}
@Override
protected void restoreSelection() {
if (!shouldSelectAll()) {
myEditor.getSelectionModel().removeSelection();
}
}
public String getInputName() {
return myInsertedName;
}
@@ -308,6 +308,8 @@ public abstract class InplaceRefactoring {
protected void beforeTemplateStart() {
myCaretRangeMarker = myEditor.getDocument()
.createRangeMarker(new TextRange(myEditor.getCaretModel().getOffset(), myEditor.getCaretModel().getOffset()));
myCaretRangeMarker.setGreedyToLeft(true);
myCaretRangeMarker.setGreedyToRight(true);
}
private void startTemplate(final TemplateBuilderImpl builder) {
@@ -396,7 +398,7 @@ public abstract class InplaceRefactoring {
}
protected int restoreCaretOffset(int offset) {
return myCaretRangeMarker.isValid() ? myCaretRangeMarker.getStartOffset() : offset;
return myCaretRangeMarker.isValid() ? myCaretRangeMarker.getEndOffset() : offset;
}
protected void navigateToAlreadyStarted(Document oldDocument, int exitCode) {
@@ -181,9 +181,7 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
try {
final PsiNamedElement variable = getVariable();
if (variable != null && !newName.equals(myOldName)) {
final NamesValidator namesValidator = LanguageNamesValidation.INSTANCE.forLanguage(variable.getLanguage());
LOG.assertTrue(namesValidator != null);
if (namesValidator.isIdentifier(newName, myProject)) {
if (isIdentifier(newName, variable.getLanguage())) {
final PsiElement substituted = getSubstituted();
if (substituted == null) {
return;
@@ -147,7 +147,7 @@ Qname'''
}
@Test
void substrings() {
void tailSubstrings() {
def header = '''\
PsiResolveHelperImpl
public static com.intellij.openapi.util.Pair&lt;com.intellij.psi.PsiType, com.intellij.psi.ConstraintType&gt; getSubstitutionForTypeParameterConstraint (com.intellij.psi.PsiTypeParameter typeParam, com.intellij.psi.PsiType param, com.intellij.psi.PsiType arg, boolean isContraVariantPosition, com.intellij.pom.java.LanguageLevel languageLevel)'''
@@ -164,4 +164,22 @@ public static com.intellij.openapi.util.Pair&lt;com.intellij.psi.PsiType, com.in
assertEquals(expected, DocPreviewUtil.buildPreview(header, null, fullText))
}
@Test
void headSubstrings() {
def header = '''\
ASTNode
com.intellij.openapi.util.TextRange getTextRange ()'''
def fullText = '''\
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://com.intellij.lang.ASTNode"><code>com.intellij.lang.ASTNode</code></a></b></small><PRE><a href="psi_element://com.intellij.openapi.util.TextRange"><code>TextRange</code></a>&nbsp;<b>getTextRange</b>()</PRE>
Returns the text range (a combination of starting offset in the document and length) for this node.
<DD><DL><DT><b>Returns:</b><DD>the text range.</DD></DL></DD></body></html>'''
def expected = '''\
<a href="psi_element://com.intellij.lang.ASTNode">ASTNode</a><br/><a href="psi_element://com.intellij.openapi.util.TextRange">TextRange</a> getTextRange ()'''
assertEquals(expected, DocPreviewUtil.buildPreview(header, null, fullText))
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -316,7 +316,7 @@ public class CheckboxTreeBase extends Tree {
myCheckbox.setVisible(true);
myCheckbox.setSelected(state != NodeState.CLEAR);
myCheckbox.setEnabled(node.isEnabled() && state != NodeState.PARTIAL);
myCheckbox.setOpaque(false);
myCheckbox.setBackground(null);
setBackground(null);
}
@@ -96,7 +96,7 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
public void setUI(final TreeUI ui) {
TreeUI actualUI = ui;
if (!isCustomUI()) {
if (!(ui instanceof WideSelectionTreeUI) && (UIUtil.isUnderAquaBasedLookAndFeel() || SystemInfo.isWindows)) { //todo[kb] fix on ubunty
if (!(ui instanceof WideSelectionTreeUI) && (UIUtil.isUnderAquaBasedLookAndFeel() || SystemInfo.isWindows) && isMacWideSelection()) { //todo[kb] fix on ubunty
actualUI = new WideSelectionTreeUI(isMacWideSelection(), !isFileColorsEnabled());
}
}
@@ -36,6 +36,7 @@ import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.ScreenUtil;
import com.intellij.ui.mac.MacPopupMenuUI;
import com.intellij.util.PlatformUtils;
import com.intellij.util.ui.UIUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -45,6 +46,7 @@ import sun.security.action.GetPropertyAction;
import javax.swing.*;
import javax.swing.event.EventListenerList;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -255,7 +257,7 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
LOG.assertTrue(laf != null);
return laf;
}
if ("Rubymine".equals(lowercaseProductName) || "Pycharm".equals(lowercaseProductName)) {
if (PlatformUtils.isRubyMine() || PlatformUtils.isPyCharm()) {
final String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
if ("gnome".equals(desktop)) {
UIManager.LookAndFeelInfo laf=findLaf(systemLafClassName);
@@ -432,8 +434,8 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
fixPopupWeight();
fixGtkPopupStyle();
final UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults();
fixTreeWideSelection(uiDefaults);
if (UIUtil.isUnderAquaLookAndFeel()) {
// update ui for popup menu to get round corners
uiDefaults.put("PopupMenuUI", MacPopupMenuUI.class.getCanonicalName());
@@ -466,6 +468,30 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
fixSeparatorColor(uiDefaults);
}
private static void fixTreeWideSelection(UIDefaults uiDefaults) {
if (UIUtil.isUnderAlloyIDEALookAndFeel()) {
final Color bg = new ColorUIResource(56, 117, 215);
uiDefaults.put("Tree.selectionBackground", bg);
uiDefaults.put("MenuItem.selectionBackground", bg);
uiDefaults.put("Menu.selectionBackground", bg);
uiDefaults.put("List.selectionBackground", bg);
uiDefaults.put("ComboBox.selectionBackground", bg);
uiDefaults.put("Table.selectionBackground", bg);
uiDefaults.put("TextArea.selectionBackground", bg);
uiDefaults.put("EditorPane.selectionBackground", bg);
uiDefaults.put("TextPane.selectionBackground", bg);
uiDefaults.put("info", bg);
uiDefaults.put("FormattedTextField.selectionBackground", bg);
uiDefaults.put("textHighlight", bg);
uiDefaults.put("PasswordField.selectionBackground", bg);
uiDefaults.put("TextField.selectionBackground", bg);
uiDefaults.put("RadioButtonMenuItem.selectionBackground", bg);
uiDefaults.put("CheckBoxMenuItem.selectionBackground", bg);
} if (UIUtil.isUnderMetalLookAndFeel()) {
uiDefaults.put("Tree.hash", new ColorUIResource(117, 117, 117));
}
}
private static void fixSeparatorColor(UIDefaults uiDefaults) {
if (UIUtil.isUnderAquaLookAndFeel()) {
uiDefaults.put("Separator.background", UIUtil.AQUA_SEPARATOR_BACKGROUND_COLOR);
@@ -18,6 +18,7 @@ package com.intellij.openapi.progress.util;
import com.intellij.ide.IdeEventQueue;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
@@ -149,16 +150,16 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
}
protected void prepareShowDialog() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
// We know at least about one use-case that requires special treatment here: many short (in terms of time) progress tasks are
// executed in a small amount of time. Problem: UI blinks and looks ugly if we show progress dialog that disappears shortly
// for each of them. Solution is to postpone the tasks of showing progress dialog. Hence, it will not be shown at all
// if the task is already finished when the time comes.
Timer timer = UIUtil.createNamedTimer("Progress window timer",myDelayInMillis, new ActionListener() {
@Override
public void run() {
// We know at least about one use-case that requires special treatment here: many short (in terms of time) progress tasks are
// executed in a small amount of time. Problem: UI blinks and looks ugly if we show progress dialog that disappears shortly
// for each of them. Solution is to postpone the tasks of showing progress dialog. Hence, it will not be shown at all
// if the task is already finished when the time comes.
Timer timer = UIUtil.createNamedTimer("Progress window timer",myDelayInMillis, new ActionListener() {
public void actionPerformed(ActionEvent e) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void actionPerformed(ActionEvent e) {
public void run() {
if (isRunning()) {
if (myDialog != null) {
final DialogWrapper popup = myDialog.myPopup;
@@ -179,11 +180,11 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
Disposer.dispose(ProgressWindow.this);
}
}
});
timer.setRepeats(false);
timer.start();
}, getModalityState());
}
});
timer.setRepeats(false);
timer.start();
}
public void startBlocking() {
@@ -353,10 +354,6 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
return myTitle;
}
protected static int getPercentage(double fraction) {
return (int)(fraction * 99 + 0.5);
}
protected class MyDialog implements Disposable {
private long myLastTimeDrawn = -1;
private volatile boolean myShouldShowBackground;
@@ -20,7 +20,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileAttributes;
import com.intellij.openapi.util.io.FileUtil;
@@ -43,23 +42,18 @@ import java.io.OutputStream;
import java.util.*;
public class JarFileSystemImpl extends JarFileSystem implements ApplicationComponent {
@NonNls private static final String IDEA_JARS_NOCOPY = "idea.jars.nocopy";
private static final class JarFileSystemImplLock { }
private static final Object LOCK = new JarFileSystemImplLock();
private final Set<String> myNoCopyJarPaths = SystemInfo.isFileSystemCaseSensitive ?
new ConcurrentHashSet<String>() :
new ConcurrentHashSet<String>(CaseInsensitiveStringHashingStrategy.INSTANCE);
private final static Logger LOG = Logger.getInstance(JarFileSystemImpl.class);
@NonNls private static final String IDEA_JARS_NOCOPY = "idea.jars.nocopy";
private File myNoCopyJarDir;
private final Map<String, JarHandler> myHandlers = new HashMap<String, JarHandler>();
private File myNoCopyJarDir;
private String[] jarPathsCache; // jarPathsCache = myHandlers.keySet()
private static final class JarFileSystemImplLock {
}
private static final Object LOCK = new JarFileSystemImplLock();
public JarFileSystemImpl(MessageBus bus) {
bus.connect().subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {
@Override
@@ -107,7 +101,7 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo
}
}
VirtualFile[] roots = VfsUtil.toVirtualFileArray(rootsToRefresh);
VirtualFile[] roots = VfsUtilCore.toVirtualFileArray(rootsToRefresh);
RefreshQueue.getInstance().refresh(false, true, null, roots);
}
};
@@ -301,8 +295,8 @@ public class JarFileSystemImpl extends JarFileSystem implements ApplicationCompo
}
@Override
public void setTimeStamp(@NotNull final VirtualFile file, final long modstamp) throws IOException {
getHandler(file).setTimeStamp(file, modstamp);
public void setTimeStamp(@NotNull final VirtualFile file, final long modStamp) throws IOException {
getHandler(file).setTimeStamp(file, modStamp);
}
@Override
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileAttributes;
import com.intellij.openapi.util.io.FileSystemUtil;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
@@ -51,6 +52,9 @@ import java.util.Locale;
public abstract class LocalFileSystemBase extends LocalFileSystem {
protected static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl");
protected static final long DEFAULT_LENGTH = 0;
protected static final long DEFAULT_TIMESTAMP = 0;
private final List<LocalFileOperationsHandler> myHandlers = new ArrayList<LocalFileOperationsHandler>();
@Override
@@ -728,8 +732,12 @@ public abstract class LocalFileSystemBase extends LocalFileSystem {
return ((flags & FileUtil.BA_EXISTS) != 0 && exists(file) ? FileUtil.BA_EXISTS : 0) |
((flags & FileUtil.BA_DIRECTORY) != 0 && isDirectory(file) ? FileUtil.BA_DIRECTORY : 0) |
((flags & FileUtil.BA_REGULAR) != 0 && !isSpecialFile(file) ? FileUtil.BA_REGULAR : 0) |
((flags & FileUtil.BA_HIDDEN) != 0 && convertToIOFile(file).isHidden() ? FileUtil.BA_HIDDEN : 0)
;
((flags & FileUtil.BA_HIDDEN) != 0 && convertToIOFile(file).isHidden() ? FileUtil.BA_HIDDEN : 0);
}
@Override
public FileAttributes getAttributes(@NotNull final VirtualFile file) {
return FileSystemUtil.getAttributes(FileUtil.toSystemDependentName(file.getPath()));
}
@Override
@@ -20,8 +20,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileAttributes;
import com.intellij.openapi.util.io.FileSystemUtil;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
@@ -534,11 +532,6 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
}
}
@Override
public FileAttributes getAttributes(@NotNull final VirtualFile file) {
return FileSystemUtil.getAttributes(FileUtil.toSystemDependentName(file.getPath()));
}
@NonNls
public String toString() {
return "LocalFileSystem";
@@ -15,27 +15,24 @@
*/
package com.intellij.openapi.vfs.impl.win32;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.win32.FileInfo;
import com.intellij.openapi.util.io.win32.IdeaWin32;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Map;
/**
* @author Dmitry Avdeev
*/
public class Win32Kernel {
public static final int FILE_ATTRIBUTE_READONLY = FileInfo.FILE_ATTRIBUTE_READONLY;
public static final int FILE_ATTRIBUTE_HIDDEN = FileInfo.FILE_ATTRIBUTE_HIDDEN;
public static final int FILE_ATTRIBUTE_DIRECTORY = FileInfo.FILE_ATTRIBUTE_DIRECTORY;
public static final int FILE_ATTRIBUTE_DEVICE = FileInfo.FILE_ATTRIBUTE_DEVICE;
public static final int FILE_ATTRIBUTE_REPARSE_POINT = FileInfo.FILE_ATTRIBUTE_REPARSE_POINT;
class Win32FsCache {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vfs.impl.win32.Win32FsCache");
private final IdeaWin32 myKernel = IdeaWin32.getInstance();
private final Map<String, FileInfo> myCache = new THashMap<String, FileInfo>();
@@ -45,11 +42,12 @@ public class Win32Kernel {
}
@NotNull
public String[] list(@NotNull String absolutePath) {
String[] list(@NotNull String absolutePath) {
FileInfo[] fileInfos = myKernel.listChildren(absolutePath.replace('/', '\\') + "\\*.*");
if (fileInfos == null) {
return ArrayUtil.EMPTY_STRING_ARRAY;
}
ArrayList<String> names = new ArrayList<String>(fileInfos.length);
for (FileInfo info : fileInfos) {
if (info.name.equals(".")) {
@@ -66,41 +64,14 @@ public class Win32Kernel {
return ArrayUtil.toStringArray(names);
}
public void exists(@NotNull String path) throws FileNotFoundException {
getInfo(path);
}
public boolean isDirectory(@NotNull String path) throws FileNotFoundException {
FileInfo data = getInfo(path);
return (data.attributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
public boolean isWritable(@NotNull String path) throws FileNotFoundException {
FileInfo fileInfo = getInfo(path);
myCache.remove(path);
return (fileInfo.attributes & FILE_ATTRIBUTE_READONLY) == 0;
}
public long getTimeStamp(@NotNull String path) throws FileNotFoundException {
long timestamp = getInfo(path).timestamp;
return timestamp / 10000 - 11644473600000l;
}
public long getLength(@NotNull String path) throws FileNotFoundException {
return getInfo(path).length;
}
@NotNull
private FileInfo getInfo(@NotNull String path) throws FileNotFoundException {
FileInfo info = doGetInfo(path);
if (info == null) {
throw new FileNotFoundException(path);
}
return info;
}
@Nullable
FileInfo doGetInfo(@NotNull String path) {
FileInfo getInfo(@NotNull VirtualFile file) {
// todo[r.sh]: uncomment and remove FS cache usage wherever it's not bulk?
//if (myCache.isEmpty()) {
// LOG.error("Called on empty cache - shouldn't happen");
//}
String path = file.getPath();
FileInfo info = myCache.get(path);
if (info == null) {
info = myKernel.getInfo(path.replace('/', '\\'));
@@ -113,21 +84,23 @@ public class Win32Kernel {
}
@FileUtil.FileBooleanAttributes
public int getBooleanAttributes(@NotNull String path, @FileUtil.FileBooleanAttributes int flags) throws FileNotFoundException {
FileInfo info = getInfo(path);
int getBooleanAttributes(@NotNull VirtualFile file, @FileUtil.FileBooleanAttributes int flags) {
FileInfo info = getInfo(file);
if (info == null) return 0;
int result = 0;
if ((flags & FileUtil.BA_EXISTS) != 0) {
result |= FileUtil.BA_EXISTS;
}
if ((flags & FileUtil.BA_DIRECTORY) != 0) {
result |= (info.attributes & FILE_ATTRIBUTE_DIRECTORY) == 0 ? 0 : FileUtil.BA_DIRECTORY;
result |= (info.attributes & FileInfo.FILE_ATTRIBUTE_DIRECTORY) == 0 ? 0 : FileUtil.BA_DIRECTORY;
}
if ((flags & FileUtil.BA_REGULAR) != 0) {
result |= (info.attributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_REPARSE_POINT)) != 0
result |= (info.attributes & (FileInfo.FILE_ATTRIBUTE_DIRECTORY | FileInfo.FILE_ATTRIBUTE_DEVICE | FileInfo.FILE_ATTRIBUTE_REPARSE_POINT)) != 0
? 0 : FileUtil.BA_REGULAR;
}
if ((flags & FileUtil.BA_HIDDEN) != 0) {
result |= (info.attributes & FILE_ATTRIBUTE_HIDDEN) == 0 ? 0 : FileUtil.BA_HIDDEN;
result |= (info.attributes & FileInfo.FILE_ATTRIBUTE_HIDDEN) == 0 ? 0 : FileUtil.BA_HIDDEN;
}
return result;
}
@@ -15,9 +15,6 @@
*/
package com.intellij.openapi.vfs.impl.win32;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileAttributes;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.win32.FileInfo;
import com.intellij.openapi.util.io.win32.IdeaWin32;
import com.intellij.openapi.vfs.VirtualFile;
@@ -26,19 +23,16 @@ import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import static com.intellij.util.BitUtil.isSet;
import static com.intellij.util.BitUtil.notSet;
/**
* @author Dmitry Avdeev
*/
public class Win32LocalFileSystem extends LocalFileSystemBase {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vfs.impl.win32.Win32LocalFileSystem");
public static boolean isAvailable() {
return IdeaWin32.isAvailable();
}
@@ -51,14 +45,13 @@ public class Win32LocalFileSystem extends LocalFileSystemBase {
};
public static Win32LocalFileSystem getWin32Instance() {
if (!isAvailable()) throw new RuntimeException("DLL is not loaded");
if (!isAvailable()) throw new RuntimeException("Native filesystem for Windows is not loaded");
Win32LocalFileSystem fileSystem = THREAD_LOCAL.get();
fileSystem.myKernel.clearCache();
fileSystem.myFsCache.clearCache();
return fileSystem;
}
private final Win32Kernel myKernel = new Win32Kernel();
public static boolean checkMe = false;
private final Win32FsCache myFsCache = new Win32FsCache();
private Win32LocalFileSystem() { }
@@ -69,90 +62,37 @@ public class Win32LocalFileSystem extends LocalFileSystemBase {
return ArrayUtil.EMPTY_STRING_ARRAY;
}
try {
String[] strings = myKernel.list(file.getPath());
if (checkMe && !Arrays.asList(strings).equals(Arrays.asList(super.list(file)))) {
LOG.error(file.getPath());
}
return strings;
}
catch (Exception e) {
if (checkMe) {
assert false;
}
return super.list(file);
}
return myFsCache.list(file.getPath());
}
@Override
public boolean exists(@NotNull VirtualFile fileOrDirectory) {
if (fileOrDirectory.getParent() == null) return true;
try {
myKernel.exists(fileOrDirectory.getPath());
if (checkMe && !super.exists(fileOrDirectory)) {
LOG.error(fileOrDirectory.getPath());
}
return true;
}
catch (FileNotFoundException e) {
return super.exists(fileOrDirectory);
}
return myFsCache.getInfo(fileOrDirectory) != null;
}
@Override
public boolean isDirectory(@NotNull VirtualFile file) {
try {
boolean b = myKernel.isDirectory(file.getPath());
if (checkMe && b != super.isDirectory(file)) {
LOG.error(file.getPath());
}
return b;
}
catch (FileNotFoundException e) {
return super.isDirectory(file);
}
final FileInfo fileInfo = myFsCache.getInfo(file);
return fileInfo != null && isSet(fileInfo.attributes, FileInfo.FILE_ATTRIBUTE_DIRECTORY);
}
@Override
public boolean isWritable(@NotNull VirtualFile file) {
try {
boolean b = myKernel.isWritable(file.getPath());
if (checkMe && b != super.isWritable(file)) {
LOG.error(file.getPath());
}
return b;
}
catch (FileNotFoundException e) {
return super.isWritable(file);
}
final FileInfo fileInfo = myFsCache.getInfo(file);
return fileInfo != null && notSet(fileInfo.attributes, FileInfo.FILE_ATTRIBUTE_READONLY);
}
@Override
public long getTimeStamp(@NotNull VirtualFile file) {
try {
long timeStamp = myKernel.getTimeStamp(file.getPath());
if (checkMe && timeStamp != super.getTimeStamp(file)) {
LOG.error(file.getPath());
}
return timeStamp;
}
catch (FileNotFoundException e) {
return super.getTimeStamp(file);
}
final FileInfo fileInfo = myFsCache.getInfo(file);
return fileInfo != null ? fileInfo.getTimestamp() : DEFAULT_TIMESTAMP;
}
@Override
public long getLength(@NotNull VirtualFile file) {
try {
long length = myKernel.getLength(file.getPath());
if (checkMe && length != super.getLength(file)) {
LOG.error(file.getPath());
}
return length;
}
catch (FileNotFoundException e) {
return super.getLength(file);
}
final FileInfo fileInfo = myFsCache.getInfo(file);
return fileInfo != null ? fileInfo.length : DEFAULT_LENGTH;
}
@NotNull
@@ -175,24 +115,6 @@ public class Win32LocalFileSystem extends LocalFileSystemBase {
@Override
public int getBooleanAttributes(@NotNull VirtualFile file, int flags) {
try {
return myKernel.getBooleanAttributes(file.getPath(), flags);
}
catch (FileNotFoundException e) {
return super.getBooleanAttributes(file, flags);
}
}
@Override
public FileAttributes getAttributes(@NotNull final VirtualFile file) {
final FileInfo fileInfo = myKernel.doGetInfo(FileUtil.toSystemDependentName(file.getPath()));
if (fileInfo == null) return null;
final boolean isDirectory = isSet(fileInfo.attributes, Win32Kernel.FILE_ATTRIBUTE_DIRECTORY);
final boolean isSpecial = isSet(fileInfo.attributes, Win32Kernel.FILE_ATTRIBUTE_DEVICE);
final boolean isSymlink = isSet(fileInfo.attributes, Win32Kernel.FILE_ATTRIBUTE_REPARSE_POINT);
final boolean isHidden = isSet(fileInfo.attributes, Win32Kernel.FILE_ATTRIBUTE_HIDDEN);
final boolean isWritable = !isSet(fileInfo.attributes, Win32Kernel.FILE_ATTRIBUTE_READONLY);
return new FileAttributes(isDirectory, isSpecial, isSymlink, isHidden, fileInfo.length, fileInfo.timestamp, isWritable);
return myFsCache.getBooleanAttributes(file, flags);
}
}
@@ -276,7 +276,7 @@ coverage.tab.title=Code Coverage
show.swing.inspector=&Enable capturing form snapshots
show.swing.inspector.disabled=&Enable capturing form snapshots (requires JRE 5.0 or higher)
before.run.property.make=Make
run.configuration.store.place.option=&Share configuration
run.configuration.store.place.option=&Share
run.configuration.default.type.description=configuration
#GeneralCommandLine
@@ -200,6 +200,9 @@ projectView.hide.dot.idea=true
show.live.templates.in.completion=false
documentation.component.editor.font=false
ide.completion.allow.finishing.by.chars=true
ide.completion.allow.finishing.by.chars.description=Controls whether typing dot, space, etc. may select the current lookup item
ide.completion.middle.matching=true
# suppress inspection "UnusedProperty"
ide.completion.middle.matching.description=Suggest items in completion that contain the entered string somewhere in the middle.
@@ -69,6 +69,9 @@
<add-to-group group-id="MainMenu" anchor="after" relative-to-action="ToolsMenu"/>
</group>
<action id="ChangesView.Revert" class="com.intellij.openapi.vcs.changes.actions.RollbackAction"
icon="AllIcons.Actions.Rollback" text="_Revert" description="Revert selected changes"/>
<group id="ChangesViewToolbar">
<action id="ChangesView.Refresh" class="com.intellij.openapi.vcs.changes.actions.RefreshAction"
icon="AllIcons.Actions.Sync"/>
@@ -0,0 +1,67 @@
/*
* Copyright 2000-2012 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.psi.search;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.ex.FakeFileType;
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
/**
* @author Dmitry Avdeev
* Date: 7/24/12
*/
public class FileTypeIndexTest extends LightPlatformCodeInsightFixtureTestCase {
public FileTypeIndexTest() {
PlatformTestCase.initPlatformLangPrefix();
}
public void testAddFileType() throws Exception {
FileType foo = new FakeFileType() {
@Override
public boolean isMyFileType(VirtualFile file) {
return true;
}
@NotNull
@Override
public String getName() {
return "foo";
}
@NotNull
@Override
public String getDescription() {
return "";
}
};
FileTypeIndex index = new FileTypeIndex(FileTypeManager.getInstance());
int version = index.getVersion();
try {
FileTypeManagerEx.getInstanceEx().registerFileType(foo);
assertNotSame(version, index.getVersion());
}
finally {
FileTypeManagerEx.getInstanceEx().unregisterFileType(foo);
}
}
}
@@ -0,0 +1,55 @@
package com.intellij.testFramework;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
import org.jetbrains.annotations.NonNls;
/**
* User: Andrey.Vokin
* Date: 7/23/12
*/
public class CodeInsightTestCase extends UsefulTestCase {
@NonNls protected static final String CARET_STR = "<caret>";
protected CodeInsightTestFixture myFixture;
protected Project getProject() {
return myFixture.getProject();
}
protected int findOffsetBySignature(String signature) {
return findOffsetBySignature(signature, myFixture.getFile());
}
protected int findOffsetBySignature(String signature, final PsiFile psiFile) {
final String caretSignature = CARET_STR;
int caretOffset = signature.indexOf(caretSignature);
assert caretOffset >= 0;
signature = signature.substring(0, caretOffset) + signature.substring(caretOffset + caretSignature.length());
int pos = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile).getText().indexOf(signature);
assertTrue(pos >= 0);
return pos + caretOffset;
}
protected PsiReference findReferenceBySignature(final String signature) {
final int offset = findOffsetBySignature(signature);
return myFixture.getFile().findReferenceAt(offset);
}
protected PsiElement findPsiBySignature(final String signature) {
return findPsiBySignature(signature, myFixture.getFile());
}
protected PsiElement findPsiBySignature(final String signature, final PsiFile psiFile) {
final int offset = findOffsetBySignature(signature, psiFile);
return psiFile.findElementAt(offset);
}
protected PsiElement findPsiBySignature(final String signature, final VirtualFile file) {
final PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
final int offset = findOffsetBySignature(signature, psiFile);
return psiFile.findElementAt(offset);
}
}
@@ -17,9 +17,9 @@ package com.intellij.openapi.util.io;
import com.intellij.util.StringBuilderSpinAllocator;
import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.Nullable;
import static com.intellij.util.BitUtil.isSet;
import static com.intellij.util.BitUtil.notSet;
/**
* @version 11.1
@@ -27,13 +27,13 @@ import static com.intellij.util.BitUtil.notSet;
*/
@SuppressWarnings("OctalInteger")
public final class FileAttributes {
public static final int DIRECTORY = 0x0001;
public static final int SPECIAL = 0x0002;
public static final int SYM_LINK = 0x0010;
public static final int HIDDEN = 0x0100;
public enum Type { FILE, DIRECTORY, SPECIAL }
@MagicConstant(flags = {DIRECTORY, SPECIAL, SYM_LINK, HIDDEN})
public @interface FileType { }
public static final byte SYM_LINK = 0x01;
public static final byte HIDDEN = 0x20;
@MagicConstant(flags = {SYM_LINK, HIDDEN})
public @interface Flags { }
public static final int OWNER_READ = 0400;
public static final int OWNER_WRITE = 0200;
@@ -48,14 +48,16 @@ public final class FileAttributes {
@MagicConstant(flags = {OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, OTHERS_READ, OTHERS_WRITE, OTHERS_EXECUTE})
public @interface Permissions { }
public static final FileAttributes BROKEN_SYMLINK = new FileAttributes(null, SYM_LINK, 0, 0, -1);
/**
* {@linkplain #DIRECTORY} and {@linkplain #SPECIAL} bits are mutually exclusive, none of them set means a regular file.<br/>
* {@linkplain #SYM_LINK} bit may be set along with above ones (which then denote a type of a link target).<br/>
* {@linkplain #HIDDEN} bit may be only set on Windows.
* {@code null} means unknown type - typically broken symlink.
*/
@FileType
public final int type;
@Nullable
public final Type type;
@Flags
public final byte flags;
/**
* In bytes, 0 for special files.<br/>
@@ -70,7 +72,7 @@ public final class FileAttributes {
public final long lastModified;
/**
* UNIX permission bits (for Windows only OWNER_WRITE matters and OWNER_READ/EXECUTE are always set), or -1 if not supported.<br/>
* UNIX permission bits (for Windows only OWNER_WRITE matters and OWNER_READ/EXECUTE are always set), or {@code -1} if not supported.<br/>
* For symlinks - permissions of a link target.
*/
@Permissions
@@ -84,7 +86,8 @@ public final class FileAttributes {
final long length,
final long lastModified,
final boolean isWritable) {
this(type(isDirectory, isSpecial, isSymlink, isHidden), length, lastModified, OWNER_READ | OWNER_EXECUTE | (isWritable ? OWNER_WRITE : 0));
this(type(isDirectory, isSpecial), flags(isSymlink, isHidden), length, lastModified,
OWNER_READ | OWNER_EXECUTE | (isWritable ? OWNER_WRITE : 0));
}
public FileAttributes(final boolean isDirectory,
@@ -93,45 +96,37 @@ public final class FileAttributes {
final long length,
final long lastModified,
@Permissions final int permissions) {
this(type(isDirectory, isSpecial, isSymlink, false), length, lastModified, permissions);
this(type(isDirectory, isSpecial), flags(isSymlink, false), length, lastModified, permissions);
}
private FileAttributes(@FileType final int type,
private FileAttributes(@Nullable final Type type,
@Flags final byte flags,
final long length,
final long lastModified,
@Permissions final int permissions) {
if (isSet(type, DIRECTORY) && isSet(type, SPECIAL)) {
throw new IllegalArgumentException("DIRECTORY and SPECIAL bits cannot be set simultaneously");
}
this.type = type;
this.flags = flags;
this.length = length;
this.lastModified = lastModified;
this.permissions = permissions;
}
@FileType
private static int type(final boolean isDirectory, final boolean isSpecial, final boolean isSymlink, final boolean isHidden) {
@FileType int type = 0;
if (isDirectory) type |= DIRECTORY;
if (isSpecial) type |= SPECIAL;
if (isSymlink) type |= SYM_LINK;
if (isHidden) type |= HIDDEN;
return type;
private static Type type(final boolean isDirectory, final boolean isSpecial) {
return isSpecial ? Type.SPECIAL :
isDirectory ? Type.DIRECTORY :
Type.FILE;
}
/** Is {@code true} for files and symlinks to files (see {@linkplain #isRegularFile()}). */
public boolean isFile() {
return notSet(type, DIRECTORY | SPECIAL);
}
/** Is {@code true} for pure regular files only (see {@linkplain #isFile()}). */
public boolean isRegularFile() {
return notSet(type, DIRECTORY | SPECIAL | SYM_LINK);
@Flags
private static byte flags(final boolean isSymlink, final boolean isHidden) {
@Flags byte flags = 0;
if (isSymlink) flags |= SYM_LINK;
if (isHidden) flags |= HIDDEN;
return flags;
}
public boolean isSymLink() {
return isSet(type, SYM_LINK);
return isSet(flags, SYM_LINK);
}
public boolean isWritable() {
@@ -143,19 +138,20 @@ public final class FileAttributes {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final FileAttributes that = (FileAttributes)o;
if (type != that.type) return false;
FileAttributes that = (FileAttributes)o;
if (flags != that.flags) return false;
if (lastModified != that.lastModified) return false;
if (permissions != that.permissions) return false;
if (length != that.length) return false;
if (permissions != that.permissions) return false;
if (type != that.type) return false;
return true;
}
@Override
public int hashCode() {
int result = type;
int result = type != null ? type.hashCode() : 0;
result = 31 * result + (int)flags;
result = 31 * result + (int)(length ^ (length >>> 32));
result = 31 * result + (int)(lastModified ^ (lastModified >>> 32));
result = 31 * result + permissions;
@@ -167,10 +163,13 @@ public final class FileAttributes {
final StringBuilder sb = StringBuilderSpinAllocator.alloc();
try {
sb.append("[type:");
if (isSet(type, DIRECTORY)) sb.append('d');
else if (isSet(type, SPECIAL)) sb.append('!');
else sb.append('f');
if (isSet(type, SYM_LINK)) sb.append('l');
if (type == Type.FILE) sb.append('f');
else if (type == Type.DIRECTORY) sb.append('d');
else if (type == Type.SPECIAL) sb.append('!');
else sb.append('-');
if (isSet(flags, SYM_LINK)) sb.append('l');
if (isSet(flags, HIDDEN)) sb.append('.');
sb.append(" length:").append(length);
@@ -242,7 +242,15 @@ public class FileSystemUtil {
Map attributes = (Map)myReadAttributes.invoke(null, pathObj, mySchema, myNoFollowLinkOptions);
final Boolean isSymbolicLink = (Boolean)attributes.get("isSymbolicLink");
if (isSymbolicLink) {
attributes = (Map)myReadAttributes.invoke(null, pathObj, mySchema, myLinkOptions);
try {
attributes = (Map)myReadAttributes.invoke(null, pathObj, mySchema, myLinkOptions);
}
catch (InvocationTargetException e) {
final Throwable cause = e.getCause();
if (cause != null && "java.nio.file.NoSuchFileException".equals(cause.getClass().getName())) {
return FileAttributes.BROKEN_SYMLINK;
}
}
}
final boolean isDirectory = (Boolean)attributes.get("isDirectory");
@@ -352,13 +360,14 @@ public class FileSystemUtil {
public FileAttributes getAttributes(@NotNull final String path) throws Exception {
final FileInfo fileInfo = myInstance.getInfo(path);
if (fileInfo == null) return null;
if (fileInfo.attributes == FileInfo.BROKEN_SYMLINK) return FileAttributes.BROKEN_SYMLINK;
final boolean isDirectory = isSet(fileInfo.attributes, FileInfo.FILE_ATTRIBUTE_DIRECTORY);
final boolean isSpecial = isSet(fileInfo.attributes, FileInfo.FILE_ATTRIBUTE_DEVICE);
final boolean isSymlink = isSet(fileInfo.attributes, FileInfo.FILE_ATTRIBUTE_REPARSE_POINT);
final boolean isHidden = isSet(fileInfo.attributes, FileInfo.FILE_ATTRIBUTE_HIDDEN);
final boolean isWritable = !isSet(fileInfo.attributes, FileInfo.FILE_ATTRIBUTE_READONLY);
final long timestamp = fileInfo.timestamp / 10000 - 11644473600000l;
final long timestamp = fileInfo.getTimestamp();
return new FileAttributes(isDirectory, isSpecial, isSymlink, isHidden, fileInfo.length, timestamp, isWritable);
}
@@ -433,7 +442,9 @@ public class FileSystemUtil {
if (isSymlink) {
mySharedMem.clear();
res = SystemInfo.isLinux ? myLibC.__xstat64(0, path, mySharedMem) : myLibC.stat(path, mySharedMem);
if (res != 0) return null;
if (res != 0) {
return FileAttributes.BROKEN_SYMLINK;
}
mode = (SystemInfo.isLinux ? mySharedMem.getInt(myModeOffset) : mySharedMem.getShort(myModeOffset)) & LibC.S_MASK;
}
@@ -24,6 +24,8 @@ import org.intellij.lang.annotations.MagicConstant;
* @since 12.0
*/
public class FileInfo {
public static final int BROKEN_SYMLINK = -1;
public static final int FILE_ATTRIBUTE_READONLY = 0x0001;
public static final int FILE_ATTRIBUTE_HIDDEN = 0x0002;
public static final int FILE_ATTRIBUTE_DIRECTORY = 0x0010;
@@ -36,6 +38,10 @@ public class FileInfo {
public long timestamp;
public long length;
public long getTimestamp() {
return timestamp / 10000 - 11644473600000l;
}
public String toString() {
return name;
}
@@ -2272,6 +2272,9 @@ public class StringUtil extends StringUtilRt {
return buffer.toString();
}
public static boolean charsEqual(char a, char b, boolean ignoreCase) {
return ignoreCase ? charsEqualIgnoreCase(a, b) : a == b;
}
public static boolean charsEqualIgnoreCase(char a, char b) {
return StringUtilRt.charsEqualIgnoreCase(a, b);
}
@@ -19,6 +19,10 @@ package com.intellij.util;
* @since 27.03.2012
*/
public class BitUtil {
public static boolean isSet(final byte value, final byte flag) {
return (value & flag) == flag;
}
public static boolean isSet(final int value, final int flag) {
return (value & flag) == flag;
}
@@ -17,6 +17,7 @@ package com.intellij.util.ui.tree;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.containers.ComparatorUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -54,6 +55,8 @@ public class WideSelectionTreeUI extends BasicTreeUI {
private boolean myWideSelection;
private boolean myAlwaysPaintRowBackground;
private boolean myOldRepaintAllRowValue;
private boolean invertLineColor;
public WideSelectionTreeUI() {
this(true, true);
@@ -216,7 +219,11 @@ public class WideSelectionTreeUI extends BasicTreeUI {
final boolean hasBeenExpanded,
final boolean isLeaf) {
if (!UIUtil.isUnderAquaBasedLookAndFeel()) {
if (UIUtil.isUnderAlloyIDEALookAndFeel()) {
invertLineColor = tree.getSelectionModel().isRowSelected(row) && tree.hasFocus();
}
super.paintHorizontalPartOfLeg(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
invertLineColor = false;
}
}
@@ -228,17 +235,42 @@ public class WideSelectionTreeUI extends BasicTreeUI {
@Override
protected void paintVerticalPartOfLeg(final Graphics g, final Rectangle clipBounds, final Insets insets, final TreePath path) {
if (!UIUtil.isUnderAquaBasedLookAndFeel()) {
invertLineColor = UIUtil.isUnderAlloyIDEALookAndFeel() && tree.hasFocus() && tree.getSelectionModel().isPathSelected(path);
super.paintVerticalPartOfLeg(g, clipBounds, insets, path);
invertLineColor = false;
}
}
@Override
protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right) {
if (!UIUtil.isUnderAquaBasedLookAndFeel()) {
super.paintHorizontalLine(g, c, y, left, right);
protected void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom) {
if (tree.hasFocus()) {
int y0 = top, y1 = top;
while (y1 < bottom) {
y0 = y1;
final int row = tree.getRowForPath(tree.getClosestPathForLocation(x, y0 + 1));
invertLineColor = tree.isRowSelected(row);
g.setColor(getHashColor());
final Rectangle bounds = tree.getRowBounds(row);
y1 = bounds.y + bounds.height;
super.paintVerticalLine(g, c, x, y0, Math.min(bottom, y1));
}
invertLineColor = false;
} else {
super.paintVerticalLine(g, c, x, top, bottom);
}
}
@Override
protected Color getHashColor() {
if (invertLineColor && !ComparatorUtil.equalsNullable(UIUtil.getTreeSelectionForeground(), UIUtil.getTreeForeground())) {
final Color c = UIUtil.getTreeSelectionForeground();
if (c != null) {
return c.darker();
}
}
return super.getHashColor();
}
public boolean isWideSelection() {
return myWideSelection;
}
@@ -49,13 +49,24 @@ public class FileAttributesReadingTest {
}
}
@Test
public void missingFile() throws Exception {
final File file = FileUtil.createTempFile(myTempDirectory, "test.", ".txt", false);
final FileAttributes attributes = FileSystemUtil.getAttributes(file);
assertNull(attributes);
final String target = FileSystemUtil.resolveSymLink(file);
assertNull(target);
}
@Test
public void regularFile() throws Exception {
final File file = FileUtil.createTempFile(myTempDirectory, "test.", ".txt", true);
FileUtil.writeToFile(file, myTestData);
final FileAttributes attributes = getAttributes(file);
assertEquals(0, attributes.type);
assertEquals(FileAttributes.Type.FILE, attributes.type);
assertEquals(0, attributes.flags);
assertEquals(myTestData.length, attributes.length);
assertTimestampEquals(file.lastModified(), attributes.lastModified);
assertTrue(attributes.isWritable());
@@ -66,7 +77,8 @@ public class FileAttributesReadingTest {
final File file = FileUtil.createTempDirectory(myTempDirectory, "test.", ".tmp");
final FileAttributes attributes = getAttributes(file);
assertEquals(FileAttributes.DIRECTORY, attributes.type);
assertEquals(FileAttributes.Type.DIRECTORY, attributes.type);
assertEquals(0, attributes.flags);
assertEquals(file.length(), attributes.length);
assertTimestampEquals(file.lastModified(), attributes.lastModified);
assertTrue(attributes.isWritable());
@@ -78,7 +90,8 @@ public class FileAttributesReadingTest {
final File file = new File("/dev/null");
final FileAttributes attributes = getAttributes(file);
assertEquals(FileAttributes.SPECIAL, attributes.type);
assertEquals(FileAttributes.Type.SPECIAL, attributes.type);
assertEquals(0, attributes.flags);
assertEquals(0, attributes.length);
assertTrue(attributes.isWritable());
}
@@ -92,7 +105,8 @@ public class FileAttributesReadingTest {
final File link = IoTestUtil.createTempLink(file.getPath(), new File(myTempDirectory, "link").getPath());
final FileAttributes attributes = getAttributes(link);
assertEquals(FileAttributes.SYM_LINK, attributes.type);
assertEquals(FileAttributes.Type.FILE, attributes.type);
assertEquals(FileAttributes.SYM_LINK, attributes.flags);
assertEquals(myTestData.length, attributes.length);
assertTimestampEquals(file.lastModified(), attributes.lastModified);
assertFalse(attributes.isWritable());
@@ -111,7 +125,8 @@ public class FileAttributesReadingTest {
final File link2 = IoTestUtil.createTempLink(link1.getPath(), new File(myTempDirectory, "link2").getPath());
final FileAttributes attributes = getAttributes(link2);
assertEquals(FileAttributes.SYM_LINK, attributes.type);
assertEquals(FileAttributes.Type.FILE, attributes.type);
assertEquals(FileAttributes.SYM_LINK, attributes.flags);
assertEquals(myTestData.length, attributes.length);
assertTimestampEquals(file.lastModified(), attributes.lastModified);
assertFalse(attributes.isWritable());
@@ -128,7 +143,8 @@ public class FileAttributesReadingTest {
final File link = IoTestUtil.createTempLink(file.getPath(), new File(myTempDirectory, "link").getPath());
final FileAttributes attributes = getAttributes(link);
assertEquals(FileAttributes.DIRECTORY | FileAttributes.SYM_LINK, attributes.type);
assertEquals(FileAttributes.Type.DIRECTORY, attributes.type);
assertEquals(FileAttributes.SYM_LINK, attributes.flags);
assertEquals(file.length(), attributes.length);
assertTimestampEquals(file.lastModified(), attributes.lastModified);
if (SystemInfo.isUnix) assertFalse(attributes.isWritable());
@@ -137,9 +153,23 @@ public class FileAttributesReadingTest {
assertEquals(file.getPath(), target);
}
@Test
public void missingLink() throws Exception {
final File file = FileUtil.createTempFile(myTempDirectory, "test.", ".txt", false);
final File link = IoTestUtil.createTempLink(file.getPath(), new File(myTempDirectory, "link").getPath());
final FileAttributes attributes = getAttributes(link);
assertNull(attributes.type);
assertEquals(FileAttributes.SYM_LINK, attributes.flags);
assertEquals(0, attributes.length);
final String target = FileSystemUtil.resolveSymLink(link);
assertNull(target);
}
@NotNull
private static FileAttributes getAttributes(@NotNull final File file) {
final FileAttributes attributes = FileSystemUtil.getAttributes(file.getPath());
final FileAttributes attributes = FileSystemUtil.getAttributes(file);
assertNotNull(attributes);
System.out.println(attributes);
return attributes;
@@ -82,9 +82,9 @@ public class RollbackAction extends AnAction implements DumbAware {
}
}
e.getPresentation().setEnabled(isEnabled);
String operationName = RollbackUtil.getRollbackOperationName(project);
e.getPresentation().setText(operationName);
if (isEnabled) {
String operationName = RollbackUtil.getRollbackOperationName(project);
e.getPresentation().setText(operationName);
e.getPresentation().setDescription(operationName + " selected changes");
}
}
@@ -417,6 +417,11 @@ public class AndroidProcessChooserDialog extends DialogWrapper {
closeOldSessionAndRun(debugPort);
}
@Override
protected String getDimensionServiceKey() {
return "AndroidProcessChooserDialog";
}
private void closeOldSessionAndRun(final String debugPort) {
final String configurationName = getRunConfigurationName(debugPort);
final Collection<RunContentDescriptor> descriptors =
@@ -107,6 +107,11 @@ public abstract class CreateResourceDirectoryDialog extends DialogWrapper {
}
}
@Override
protected String getDimensionServiceKey() {
return "AndroidCreateResourceDirectoryDialog";
}
@Override
public JComponent getPreferredFocusedComponent() {
return myResourceTypeComboBox;
@@ -265,6 +265,11 @@ public class CreateResourceFileDialog extends DialogWrapper {
}
}
@Override
protected String getDimensionServiceKey() {
return "AndroidCreateResourceFileDialog";
}
@NotNull
public Module getSelectedModule() {
return (Module)myModuleCombo.getSelectedItem();
@@ -435,6 +435,11 @@ public class CreateXmlResourceDialog extends DialogWrapper {
}
}
@Override
protected String getDimensionServiceKey() {
return "AndroidCreateXmlResourceDialog";
}
@NotNull
public String getResourceName() {
return myNameField.getText().trim();
@@ -252,11 +252,16 @@ class ApkStep extends ExportSignedPackageWizardStep {
public void run() {
String title = AndroidBundle.message("android.export.package.wizard.title");
final Project project = myWizard.getProject();
final File apkFile = new File(apkPath);
final VirtualFile vApkFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(apkFile);
if (vApkFile != null) {
vApkFile.refresh(true, false);
}
if (!runZipAlign) {
Messages.showWarningDialog(project, AndroidBundle.message("cannot.find.zip.align"), title);
}
final File apkFile = new File(apkPath);
if (ShowFilePathAction.isSupported()) {
if (Messages.showOkCancelDialog(project, AndroidBundle.message("android.export.package.success.message", apkFile.getName()),
@@ -1,71 +0,0 @@
package org.jetbrains.android.exportSignedPackage;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.ui.CollectionComboBoxModel;
import com.intellij.ui.components.JBCheckBox;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.util.ModuleListCellRendererWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* @author Eugene.Kudelevsky
*/
public class GenerateSignedApkDialog extends DialogWrapper {
private JCheckBox myProGuardCheckBox;
private JComboBox myModuleComboBox;
private JPanel myPanel;
private JPasswordField myKeyStorePasswordField;
private JPasswordField myKeyPasswordField;
private TextFieldWithBrowseButton.NoPathCompletion myKeyAliasField;
private JTextField myKeyStorePathField;
private JPanel myKeyStoreButtonsPanel;
private JButton myCreateKeyStoreButton;
private JButton myLoadKeyStoreButton;
private JBCheckBox myRememberPasswordsCheckBox;
private TextFieldWithBrowseButton myProGuardConfigFilePathField;
private JCheckBox myIncludeSystemProGuardFileCheckBox;
private TextFieldWithBrowseButton.NoPathCompletion myApkPathField;
protected GenerateSignedApkDialog(@NotNull Project project, @Nullable Module defaultModule) {
super(project);
setTitle("Generate Signed APK");
final List<Module> androidAppModules = new ArrayList<Module>();
for (Module module : ModuleManager.getInstance(project).getModules()) {
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null && !facet.getConfiguration().LIBRARY_PROJECT) {
androidAppModules.add(module);
}
}
myModuleComboBox.setModel(
new CollectionComboBoxModel(androidAppModules, androidAppModules.contains(defaultModule) ? defaultModule : androidAppModules.get(0)));
myModuleComboBox.setRenderer(new ModuleListCellRendererWrapper(myModuleComboBox.getRenderer()));
myModuleComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//To change body of implemented methods use File | Settings | File Templates.
}
});
init();
}
@Override
protected JComponent createCenterPanel() {
return myPanel;
}
}
@@ -1,187 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.android.exportSignedPackage.GenerateSignedApkDialog">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="12" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="537" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="4bd1e">
<constraints>
<grid row="11" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="c4bb3" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="e1182"/>
<text value="&amp;Destination APK path:"/>
</properties>
</component>
<component id="e1182" class="com.intellij.openapi.ui.TextFieldWithBrowseButton$NoPathCompletion" binding="myApkPathField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="d9f17" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="6934f"/>
<text value="M&amp;odule:"/>
</properties>
</component>
<component id="6934f" class="javax.swing.JComboBox" binding="myModuleComboBox">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="ea484" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="940dd"/>
<text value="&amp;Key store path: "/>
</properties>
</component>
<component id="423a2" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="462d5"/>
<text value="Key store &amp;password:"/>
</properties>
</component>
<component id="462d5" class="javax.swing.JPasswordField" binding="myKeyStorePasswordField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="b5050" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="b9e84"/>
<text value="K&amp;ey alias: "/>
</properties>
</component>
<component id="3cb1d" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<labelFor value="9b51d"/>
<text value="Key pass&amp;word:"/>
</properties>
</component>
<component id="9b51d" class="javax.swing.JPasswordField" binding="myKeyPasswordField">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="b9e84" class="com.intellij.openapi.ui.TextFieldWithBrowseButton$NoPathCompletion" binding="myKeyAliasField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="940dd" class="javax.swing.JTextField" binding="myKeyStorePathField">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<grid id="594cb" binding="myKeyStoreButtonsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none">
<size top="0" left="0" bottom="5" right="0"/>
</border>
<children>
<component id="b7d31" class="javax.swing.JButton" binding="myCreateKeyStoreButton">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Create new..."/>
</properties>
</component>
<component id="e91cc" class="javax.swing.JButton" binding="myLoadKeyStoreButton">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Choose existing..."/>
</properties>
</component>
<hspacer id="f711b">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
<component id="fda8d" class="com.intellij.ui.components.JBCheckBox" binding="myRememberPasswordsCheckBox">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Re&amp;member passwords"/>
</properties>
</component>
<component id="dbef" class="javax.swing.JCheckBox" binding="myProGuardCheckBox">
<constraints>
<grid row="8" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Run ProGuard"/>
</properties>
</component>
<component id="4b87b" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<anchor value=""/>
<labelFor value="6e08d"/>
<text value="Config &amp;file path:"/>
</properties>
</component>
<component id="6e08d" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myProGuardConfigFilePathField">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="819c2" class="javax.swing.JCheckBox" binding="myIncludeSystemProGuardFileCheckBox">
<constraints>
<grid row="10" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Include system proguard file"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.android.newProject.CreateLibraryDialog">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="504" height="144"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="f96f7">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="67712" class="javax.swing.JRadioButton" binding="myProjectLibButton">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/AndroidBundle" key="create.project.library"/>
</properties>
</component>
<component id="27fc" class="javax.swing.JRadioButton" binding="myGlobalLibButton">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/AndroidBundle" key="create.global.library"/>
</properties>
</component>
</children>
</grid>
<buttonGroups>
<group name="buttonGroup">
<member id="67712"/>
<member id="27fc"/>
</group>
</buttonGroups>
</form>
@@ -1,60 +0,0 @@
/*
* 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 org.jetbrains.android.newProject;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.android.util.AndroidBundle;
import javax.swing.*;
import java.awt.event.KeyEvent;
/**
* Created by IntelliJ IDEA.
* User: Eugene.Kudelevsky
* Date: Aug 13, 2009
* Time: 4:21:39 PM
* To change this template use File | Settings | File Templates.
*/
public class CreateLibraryDialog extends DialogWrapper {
private JPanel myPanel;
private JRadioButton myProjectLibButton;
private JRadioButton myGlobalLibButton;
public CreateLibraryDialog(@NotNull Project project, @NotNull String libraryName) {
super(project, true);
setModal(true);
setTitle(AndroidBundle.message("create.library.dialog.title"));
myProjectLibButton.setSelected(true);
myProjectLibButton.setMnemonic(KeyEvent.VK_P);
myGlobalLibButton.setMnemonic(KeyEvent.VK_G);
myProjectLibButton.setText(AndroidBundle.message("create.project.library", libraryName));
myGlobalLibButton.setText(AndroidBundle.message("create.global.library", libraryName));
init();
}
@Override
protected JComponent createCenterPanel() {
return myPanel;
}
public boolean isGlobalSelected() {
return myGlobalLibButton.isSelected();
}
}
@@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.android.run.AvdChooser">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="510" height="339"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="8eaf6" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="1" column="0" row-span="5" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="dcd2c" class="com.intellij.ui.table.JBTable" binding="myAvdTable">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<component id="61487" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="355" height="14"/>
</grid>
</constraints>
<properties>
<labelFor value="8eaf6"/>
<text value="&amp;Existing Android Virtual Devices:"/>
</properties>
</component>
<component id="24c3" class="javax.swing.JButton" binding="myCreateButton">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Create"/>
</properties>
</component>
<vspacer id="e2c2c">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="9d2d5" class="javax.swing.JButton" binding="myRemoveButton">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Remove"/>
</properties>
</component>
<component id="90656" class="javax.swing.JButton" binding="myRefreshButton" default-binding="true">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Re&amp;fresh"/>
</properties>
</component>
<component id="eb4de" class="javax.swing.JButton" binding="myStartAvdManagerButton">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Android SDK Manager"/>
</properties>
</component>
</children>
</grid>
</form>

Some files were not shown because too many files have changed in this diff Show More