Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2011-11-21 18:04:28 +04:00
36 changed files with 295 additions and 125 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.codeInsight.editorActions;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RawText;
@@ -176,11 +177,13 @@ public class StringLiteralCopyPasteProcessor implements CopyPastePreProcessor {
}
protected boolean isCharLiteral(@NotNull PsiElement token) {
return token.getNode().getElementType() == JavaTokenType.CHARACTER_LITERAL;
ASTNode node = token.getNode();
return node != null && node.getElementType() == JavaTokenType.CHARACTER_LITERAL;
}
protected boolean isStringLiteral(@NotNull PsiElement token) {
return token.getNode().getElementType() == JavaTokenType.STRING_LITERAL;
ASTNode node = token.getNode();
return node != null && node.getElementType() == JavaTokenType.STRING_LITERAL;
}
@NotNull
@@ -125,11 +125,16 @@ public class CopyClassesHandler implements CopyHandlerDelegate {
VirtualFile sourceRootForFile = ProjectRootManager.getInstance(project).getFileIndex()
.getSourceRootForFile(defaultTargetDirectory.getVirtualFile());
if (sourceRootForFile == null) {
final PsiFile[] files = new PsiFile[elements.length];
final List<PsiElement> files = new ArrayList<PsiElement>();
for (int i = 0, elementsLength = elements.length; i < elementsLength; i++) {
files[i] = elements[i].getContainingFile();
PsiFile containingFile = elements[i].getContainingFile();
if (containingFile != null) {
files.add(containingFile);
} else if (elements[i] instanceof PsiDirectory) {
files.add(elements[i]);
}
}
CopyFilesOrDirectoriesHandler.copyAsFiles(files, defaultTargetDirectory, project);
CopyFilesOrDirectoriesHandler.copyAsFiles(files.toArray(new PsiElement[files.size()]), defaultTargetDirectory, project);
return;
}
}
@@ -133,6 +133,7 @@ public class PullUpHelper extends BaseRefactoringProcessor{
}
private void processMethodsDuplicates() {
if (!myTargetSuperClass.isValid()) return;
ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
@Override
public void run() {
@@ -103,6 +103,7 @@ public abstract class Builder {
private static boolean chunkContainsAffectedFiles(CompileContext context, ModuleChunk chunk, final Set<File> affected) throws Exception {
final Ref<Boolean> result = new Ref<Boolean>(false);
// todo: avoid calling processFiles to implement this logic
context.processFiles(chunk, new FileProcessor() {
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
if (affected.contains(file)) {
@@ -82,13 +82,13 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
public void setDirty(ModuleChunk chunk, boolean isDirty) {
final Set<Module> modules = chunk.getModules();
if (isDirty) {
myDirtyModules.addAll(modules);
}
else {
if (!isDirty) {
myDirtyModules.removeAll(modules);
return;
}
myDirtyModules.addAll(modules);
// now mark all modules that depend on dirty modules
final ClasspathKind classpathKind = ClasspathKind.compile(isCompilingTests());
final ProjectChunks chunks = isCompilingTests()? myTestChunks : myProductionChunks;
@@ -11,6 +11,7 @@ import org.jetbrains.jps.incremental.storage.OutputToSourceMapping;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.*;
/**
@@ -41,7 +42,10 @@ public class IncProjectBuilder {
public void addMessageHandler(MessageHandler handler) {
myMessageHandlers.add(handler);
}
// todo: pass dirty and removed sources from outside
public void build(CompileScope scope, final boolean isMake) {
final CompileContext context = createContext(scope, isMake);
@@ -75,6 +79,18 @@ public class IncProjectBuilder {
}
finally {
context.getBuildDataManager().close();
cleanupJavacNameTable();
}
}
private static void cleanupJavacNameTable() {
try {
final Field freelistField = Class.forName("com.sun.tools.javac.util.Name$Table").getDeclaredField("freelist");
freelistField.setAccessible(true);
freelistField.set(null, com.sun.tools.javac.util.List.nil());
}
catch (Throwable e) {
e.printStackTrace();
}
}
@@ -210,6 +226,8 @@ public class IncProjectBuilder {
// TODO: check how the output-source storage is filled and!
if (context.isMake()) {
// cleanup outputs
// todo: use dirty and removed paths passed from IDEA instead of collecting all chunk sources
final HashSet<File> allChunkSources = new HashSet<File>();
context.processFiles(chunk, new FilesCollector(allChunkSources, FilesCollector.ALL_FILES));
@@ -20,7 +20,7 @@ import org.jetbrains.jps.incremental.storage.TimestampStorage;
import org.jetbrains.jps.server.ClasspathBootstrap;
import org.objectweb.asm.ClassReader;
import java.io.*;
import java.io.File;
import java.util.*;
/**
@@ -46,6 +46,7 @@ public class GroovyBuilder extends Builder {
final List<File> toCompile = new ArrayList<File>();
try {
final TimestampStorage tsStorage = context.getBuildDataManager().getTimestampStorage(getName());
// todo: use dirty files passed from outside
context.processFiles(chunk, new FileProcessor() {
@Override
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
@@ -118,10 +118,11 @@ public class JavaBuilder extends Builder{
final Set<File> filesToCompile = new LinkedHashSet<File>();
final List<File> formsToCompile = new ArrayList<File>();
final List<File> upToDateForms = new ArrayList<File>();
// todo: read srcRoots from JPS model
final Set<String> srcRoots = new HashSet<String>();
final boolean wholeModuleRebuildRequired = context.isDirty(chunk);
// todo: only process all sources if wholeModuleRebuild == true
context.processFiles(chunk, new FileProcessor() {
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
if (JAVA_SOURCES_FILTER.accept(file)) {
@@ -142,6 +143,8 @@ public class JavaBuilder extends Builder{
}
});
// todo: change logic below so that complete forms list is not required
// force compilation of bound source file if the form is dirty
for (File form : formsToCompile) {
for (String root : srcRoots) {
@@ -50,6 +50,8 @@ public class ResourcesBuilder extends Builder{
final TimestampStorage tsStorage = context.getBuildDataManager().getTimestampStorage(BUILDER_NAME);
final OutputToSourceMapping outputToSourceMapping = context.getBuildDataManager().getOutputToSourceStorage();
final ResourcePatterns finalPatterns = patterns;
// todo: process all files in case of rebuild or wholeModuleDirty
// todo: otherwise avoid traverwing the whole module and use dirty file list taken from params
context.processFiles(chunk, new FileProcessor() {
public boolean apply(final Module module, final File file, final String sourceRoot) throws Exception {
if (finalPatterns.isResourceFile(file, sourceRoot)) {
@@ -168,7 +168,7 @@ public class InitialConfigurationDialog extends DialogWrapper {
myPreviewOptions.selectScheme(((EditorColorsScheme)myColorSchemeComboBox.getSelectedItem()).getName());
final NewColorAndFontPanel page = myPreviewOptions.findPage(myColorSettingsPage);
assert page != null;
myPreviewEditor = new SimpleEditorPreview(myPreviewOptions, page.getSettingsPage());
myPreviewEditor = new SimpleEditorPreview(myPreviewOptions, page.getSettingsPage(), false);
myPreviewEditor.updateView();
myColorPreviewPanel.add(myPreviewEditor.getPanel(), BorderLayout.CENTER);
myColorPreviewPanel.revalidate();
@@ -57,6 +57,10 @@ public class SimpleEditorPreview implements PreviewPanel{
private final EventDispatcher<ColorAndFontSettingsListener> myDispatcher = EventDispatcher.create(ColorAndFontSettingsListener.class);
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page) {
this(options, page, true);
}
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page, final boolean navigatable) {
myOptions = options;
myPage = page;
@@ -70,17 +74,16 @@ public class SimpleEditorPreview implements PreviewPanel{
FontEditorPreview.installTrafficLights(myEditor);
myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent());
if (navigatable) {
addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
CaretListener listener = new CaretListener() {
public void caretPositionChanged(CaretEvent e) {
navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
}
};
myEditor.getCaretModel().addCaretListener(listener);
CaretListener listener = new CaretListener() {
public void caretPositionChanged(CaretEvent e) {
navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
}
};
myEditor.getCaretModel().addCaretListener(listener);
}
}
private void addMouseMotionListener(final Editor view,
@@ -860,6 +860,9 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
private void watchTail(int offset) {
stopWatching();
tailWatcher = (RangeMarkerEx)getDocument().createRangeMarker(offset, offset);
if (!tailWatcher.isValid()) {
throw new AssertionError(getDocument() + "; offset=" + offset);
}
tailWatcher.setGreedyToRight(true);
spy = new RangeMarkerSpy(tailWatcher) {
@Override
@@ -83,7 +83,7 @@ public abstract class AbstractNavBarUI implements NavBarUI {
int h = item.getHeight();
final Paint bg = floating ? Color.WHITE : new GradientPaint(0, 0, new Color(255, 255, 255, 30), 0, h, new Color(255, 255, 255, 10));
final Color selection = floating ? UIUtil.getListSelectionBackground() : new Color(0, 0, 0, 60);
final Color selection = UIUtil.getListSelectionBackground();
final boolean selected = item.isSelected() && item.isFocused();
@@ -173,8 +173,7 @@ public abstract class AbstractNavBarUI implements NavBarUI {
@Override
public Insets getWrapperPanelInsets(Insets insets) {
return new Insets(insets.top + (shouldPaintWrapperPanel() ? 5 : 0), insets.left,
insets.bottom + (shouldPaintWrapperPanel() ? 5 : 0), insets.right);
return new Insets(insets.top + (shouldPaintWrapperPanel() ? 1 : 0), insets.left, insets.bottom, insets.right);
}
private static boolean shouldPaintWrapperPanel() {
@@ -156,7 +156,7 @@ public class DirectoryNode extends PackageDependenciesNode {
@Nullable
private PsiDirectory getPsiDirectory() {
if (myDirectory == null) {
if (myVDirectory.isValid()) {
if (myVDirectory.isValid() && !myProject.isDisposed()) {
myDirectory = PsiManager.getInstance(myProject).findDirectory(myVDirectory);
}
}
@@ -38,7 +38,8 @@ public class ChangeSignatureDetectorAction extends RefactoringBaseIntention {
@NotNull
@Override
public String getText() {
return myAcceptText;
final String text = myAcceptText;
return text != null ? text : CHANGE_SIGNATURE;
}
@NotNull
@@ -81,7 +81,8 @@ public class ChangeSignaturePassFactory extends AbstractProjectComponent impleme
if (changeInfo != null) {
final PsiElement element = changeInfo.getMethod();
int offset = myEditor.getCaretModel().getOffset();
if (!element.getTextRange().contains(offset)) return;
final TextRange elementTextRange = element.getTextRange();
if (elementTextRange == null || !elementTextRange.contains(offset)) return;
final TextRange range = getHighlightingRange(changeInfo);
if (range != null && detector.isChangeSignatureAvailable(element)) {
myRange = range;
@@ -159,6 +159,7 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
}
private void restore(final PsiNamedElement variable, String commandName) {
if (variable == null) return;
final RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(variable);
final PsiElement substituted = processor.substituteElementToRename(variable, myEditor);
if (substituted != null) {
@@ -20,7 +20,6 @@ import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.encoding.EncodingManager;
@@ -28,6 +27,8 @@ import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
/**
* @author Elena Shaverdova
* @author Nikolay Matveev
@@ -43,15 +44,6 @@ public final class ScriptRunnerUtil {
}
};
public static final Condition<Key> STDERR_OUTPUT_KEY_FILTER = new Condition<Key>() {
@Override
public boolean value(Key key) {
return ProcessOutputTypes.STDERR.equals(key);
}
};
public static final Condition<Key> STDOUT_OR_STDERR_OUTPUT_KEY_FILTER = Conditions.or(STDOUT_OUTPUT_KEY_FILTER, STDERR_OUTPUT_KEY_FILTER);
private static final int DEFAULT_TIMEOUT = 30000;
private ScriptRunnerUtil() {
@@ -101,10 +93,14 @@ public final class ScriptRunnerUtil {
public static OSProcessHandler execute(@NotNull String exePath,
@Nullable String workingDirectory,
@Nullable VirtualFile scriptFile,
String[] parameters) throws ExecutionException {
String[] parameters,
@Nullable Map<String, String> environmentParams) throws ExecutionException {
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(exePath);
commandLine.setPassParentEnvs(true);
if (environmentParams != null) {
commandLine.setEnvParams(environmentParams);
}
if (scriptFile != null) {
commandLine.addParameter(scriptFile.getPresentableUrl());
}
@@ -139,7 +135,7 @@ public final class ScriptRunnerUtil {
ScriptOutputType scriptOutputType,
@NonNls String... parameters)
throws ExecutionException {
final OSProcessHandler processHandler = execute(exePathString, workingDirectory, scriptFile, parameters);
final OSProcessHandler processHandler = execute(exePathString, workingDirectory, scriptFile, parameters, null);
final StringBuilder standardOutput = scriptOutputType.readStandardOutput() ? new StringBuilder() : null;
final StringBuilder errorOutput = scriptOutputType.readErrorOutput() ? new StringBuilder() : null;
@@ -15,10 +15,10 @@
*/
package com.intellij.ide.actions;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManager;
import com.intellij.ui.content.ContentManagerUtil;
@@ -26,10 +26,20 @@ import com.intellij.ui.content.ContentManagerUtil;
public class CloseActiveTabAction extends AnAction implements DumbAware {
public void actionPerformed(AnActionEvent e) {
ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
boolean processed = false;
if (contentManager != null && contentManager.canCloseContents()) {
final Content selectedContent = contentManager.getSelectedContent();
if (selectedContent != null && selectedContent.isCloseable()) {
contentManager.removeContent(selectedContent, true);
processed = true;
}
}
if (!processed && contentManager != null) {
final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
final ToolWindow tw = PlatformDataKeys.TOOL_WINDOW.getData(context);
if (tw != null) {
tw.hide(null);
}
}
}
@@ -38,5 +48,10 @@ public class CloseActiveTabAction extends AnAction implements DumbAware {
Presentation presentation = event.getPresentation();
ContentManager contentManager=ContentManagerUtil.getContentManagerFromContext(event.getDataContext(), true);
presentation.setEnabled(contentManager != null && contentManager.canCloseContents());
if (!presentation.isEnabled() && contentManager != null) {
final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
presentation.setEnabled(PlatformDataKeys.TOOL_WINDOW.getData(context) != null);
}
}
}
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -111,7 +112,7 @@ public class LogModel implements Disposable {
Runnable handler = removeHandlers.remove(notification);
if (handler != null) {
handler.run();
UIUtil.invokeLaterIfNeeded(handler);
}
Pair<Notification, Long> oldStatus = getStatusMessage();
@@ -449,8 +449,8 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
}
for (final Rectangle r : bounds) {
if (r.height < maxHeight && r.y == 0) {
r.y = (maxHeight - r.height) / 2;
if (r.height < maxHeight) {
r.y = r.y + (maxHeight - r.height) / 2;
}
}
@@ -397,8 +397,10 @@ final class Stripe extends JPanel{
public void setOverlayed(boolean overlayed) {
Color bg = UIUtil.getPanelBackground();
float[] result = Color.RGBtoHSB(bg.getRed(), bg.getGreen(), bg.getBlue(), new float[3]);
bg = new Color(Color.HSBtoRGB(result[0], result[1], result[2] - 0.08f > 0 ? result[2] - 0.08f : result[2]));
if (UIUtil.isUnderAquaLookAndFeel()) {
float[] result = Color.RGBtoHSB(bg.getRed(), bg.getGreen(), bg.getBlue(), new float[3]);
bg = new Color(Color.HSBtoRGB(result[0], result[1], result[2] - 0.08f > 0 ? result[2] - 0.08f : result[2]));
}
if (overlayed) {
setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(), 190));
} else {
@@ -58,6 +58,7 @@ public class ActivityMonitorTest extends UsefulTestCase {
}
}, getTestRootDisposable());
myMonitor = new UiActivityMonitorImpl(new MockApplication(getTestRootDisposable()));
myMonitor.setActive(true);
disposeOnTearDown(myMonitor);
}
@@ -25,6 +25,7 @@ import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.InspectionGadgetsFix;
import com.siyeh.ig.psiutils.LibraryUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -99,7 +100,10 @@ public class MethodCanBeVariableArityMethodInspection extends BaseInspection {
final PsiTypeElement newTypeElement =
factory.createTypeElementFromText(
componentType.getCanonicalText() + "...", method);
lastParameter.getTypeElement().replace(newTypeElement);
final PsiTypeElement typeElement = lastParameter.getTypeElement();
if (typeElement != null) {
typeElement.replace(newTypeElement);
}
}
}
@@ -143,6 +147,9 @@ public class MethodCanBeVariableArityMethodInspection extends BaseInspection {
return;
}
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Bas Leijdekkers
* Copyright 2010-2011 Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,16 +33,14 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
@NotNull
@Override
public String getDisplayName() {
return InspectionGadgetsBundle.message(
"simplifiable.annotation.display.name");
return InspectionGadgetsBundle.message("simplifiable.annotation.display.name");
}
@NotNull
@Override
protected String buildErrorString(Object... infos) {
final String replacement = (String)infos[0];
return InspectionGadgetsBundle.message(
"simplifiable.annotation.problem.descriptor", replacement);
return InspectionGadgetsBundle.message("simplifiable.annotation.problem.descriptor", replacement);
}
@Override
@@ -51,8 +49,7 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
return new SimplifiableAnnotationFix(replacement);
}
private static class SimplifiableAnnotationFix
extends InspectionGadgetsFix {
private static class SimplifiableAnnotationFix extends InspectionGadgetsFix {
private final String replacement;
@@ -67,16 +64,13 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
}
@Override
protected void doFix(Project project, ProblemDescriptor descriptor)
throws IncorrectOperationException {
protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
final PsiElement element = descriptor.getPsiElement();
if (!(element instanceof PsiAnnotation)) {
return;
}
final PsiElementFactory factory =
JavaPsiFacade.getElementFactory(project);
final PsiAnnotation annotation =
factory.createAnnotationFromText(replacement, element);
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
final PsiAnnotation annotation = factory.createAnnotationFromText(replacement, element);
element.replace(annotation);
}
}
@@ -86,16 +80,13 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
return new SimplifiableAnnotationVisitor();
}
private static class SimplifiableAnnotationVisitor
extends BaseInspectionVisitor {
private static class SimplifiableAnnotationVisitor extends BaseInspectionVisitor {
@Override
public void visitAnnotation(PsiAnnotation annotation) {
super.visitAnnotation(annotation);
final PsiAnnotationParameterList parameterList =
annotation.getParameterList();
final PsiJavaCodeReferenceElement nameReferenceElement =
annotation.getNameReferenceElement();
final PsiAnnotationParameterList parameterList = annotation.getParameterList();
final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement();
if (nameReferenceElement == null) {
return;
}
@@ -107,8 +98,7 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
final String annotationName = nameReferenceElement.getText();
final String replacementText;
if (attributes.length > 0) {
replacementText = '@' + annotationName +
parameterList.getText();
replacementText = '@' + annotationName + parameterList.getText();
}
else {
replacementText = '@' + annotationName;
@@ -128,8 +118,7 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
else if (attributes.length == 1) {
final PsiNameValuePair attribute = attributes[0];
@NonNls final String name = attribute.getName();
final PsiAnnotationMemberValue attributeValue =
attribute.getValue();
final PsiAnnotationMemberValue attributeValue = attribute.getValue();
if (attributeValue == null) {
return;
}
@@ -138,32 +127,30 @@ public class SimplifiableAnnotationInspection extends BaseInspection {
if (!(attributeValue instanceof PsiArrayInitializerMemberValue)) {
return;
}
final PsiArrayInitializerMemberValue arrayValue =
(PsiArrayInitializerMemberValue)attributeValue;
final PsiAnnotationMemberValue[] initializers =
arrayValue.getInitializers();
final PsiArrayInitializerMemberValue arrayValue = (PsiArrayInitializerMemberValue)attributeValue;
final PsiAnnotationMemberValue[] initializers = arrayValue.getInitializers();
if (initializers.length != 1) {
return;
}
attributeValueText = initializers[0].getText();
if (name == null) {
attributeValueText = initializers[0].getText();
} else {
attributeValueText = name + '=' + initializers[0].getText();
}
}
else {
attributeValueText = attributeValue.getText();
attributeValueText = getAttributeValueText(attributeValue);
}
final String annotationName = nameReferenceElement.getText();
final String replacementText = '@' + annotationName +
'(' + getAttributeValueText(attributeValue) + ')';
final String replacementText = '@' + annotationName + '(' + attributeValueText + ')';
registerError(annotation, replacementText);
}
}
private static String getAttributeValueText(
PsiAnnotationMemberValue value) {
private static String getAttributeValueText(PsiAnnotationMemberValue value) {
if (value instanceof PsiArrayInitializerMemberValue) {
final PsiArrayInitializerMemberValue arrayValue =
(PsiArrayInitializerMemberValue)value;
final PsiAnnotationMemberValue[] initializers =
arrayValue.getInitializers();
final PsiArrayInitializerMemberValue arrayValue = (PsiArrayInitializerMemberValue)value;
final PsiAnnotationMemberValue[] initializers = arrayValue.getInitializers();
if (initializers.length == 1) {
return initializers[0].getText();
}
@@ -1,9 +1,9 @@
<html>
<body>
This inspection reports annotations which can be simplified to their 'single element'
or 'marker' shorthand form. Annotation that contain whitespace between the @-sign and the name
or 'marker' shorthand form. Annotations that contain whitespace between the @-sign and the name
of the annotation are also reported.
<p>
<small>New in 10.0.2, Powered by InspectionGadgets </small>
<small>New in 10, Powered by InspectionGadgets </small>
</body>
</html>
@@ -1,7 +1,7 @@
package com.siyeh.igtest.migration.method_can_be_variable_arity_method;
import java.io.IOException;
import java.io.Reader;
public class MethodCanBeVariableArity {
@@ -11,3 +11,10 @@ public class MethodCanBeVariableArity {
public void convertMeNot(byte[] bs) {}
}
abstract class MyInputStream extends Reader {
@Override
public int read(char[] cbuf) throws IOException {
return super.read(cbuf);
}
}
@@ -7,4 +7,14 @@ public class SimplifiableAnnotation {
Object foo() {
return null;
}
}
@interface ValueAnnotation {
String[] value();
}
@interface ArrayAnnotation {
String[] array();
}
@ValueAnnotation({"the value"})
@ArrayAnnotation(array = {"first"})
class MyClass {
}
@@ -13,4 +13,18 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplifiable annotation</problem_class>
<description>Annotation &lt;code&gt;@ Deprecated()&lt;/code&gt; may be replaced with '@Deprecated'</description>
</problem>
<problem>
<file>SimplifiableAnnotation.java</file>
<line>17</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplifiable annotation</problem_class>
<description>Annotation &lt;code&gt;@ValueAnnotation({&quot;the value&quot;})&lt;/code&gt; may be replaced with '@ValueAnnotation(&quot;the value&quot;)' #loc</description>
</problem>
<problem>
<file>SimplifiableAnnotation.java</file>
<line>18</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplifiable annotation</problem_class>
<description>Annotation &lt;code&gt;@ArrayAnnotation(array = {&quot;first&quot;})&lt;/code&gt; may be replaced with '@ArrayAnnotation(array=&quot;first&quot;)' #loc</description>
</problem>
</problems>
@@ -295,4 +295,5 @@ android.logcat.add.logcat.filter.button=Add a new logcat filter
android.logcat.new.logcat.dialog.label=<html>Filter logcat messages by different parameters.<br>Empty fields will match all messages.</html>
android.logcat.new.filter.dialog.name.busy.error=Filter {0} already exists
android.compile.messages.processing.external.apklib.dependencies=Processing external apklib dependencies
android.maven.cannot.parse.android.sdk.error=Cannot parse Android SDK for module {0}. Try to force reimport from Maven model
android.maven.cannot.parse.android.sdk.error=Cannot parse Android SDK for module {0}. Try to force reimport from Maven model
android.facet.settings.custom.debug.keystore.label=C&ustom debug keystore\:
@@ -15,6 +15,7 @@
*/
package org.jetbrains.android.compiler;
import com.intellij.compiler.CompilerIOUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.*;
import com.intellij.openapi.module.Module;
@@ -127,8 +128,10 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
AndroidBundle.message("android.compilation.error.apk.path.not.specified", module.getName()), null, -1, -1);
continue;
}
items.add(createItem(module, facet, manifestFile, sourceRoots, externalJars, resPackagePath, classesDexPath, sdkPath,
outputPath, configuration.GENERATE_UNSIGNED_APK, AndroidCompileUtil.isReleaseBuild(context)));
final String keystorePath = FileUtil.toSystemDependentName(VfsUtil.urlToPath(configuration.CUSTOM_DEBUG_KEYSTORE_PATH));
items.add(
createItem(module, facet, manifestFile, sourceRoots, externalJars, resPackagePath, classesDexPath, sdkPath, outputPath,
configuration.GENERATE_UNSIGNED_APK, AndroidCompileUtil.isReleaseBuild(context), keystorePath));
}
}
}
@@ -146,9 +149,10 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
String sdkPath,
String outputPath,
boolean generateSignedApk,
boolean releaseBuild) {
boolean releaseBuild,
String customKeystorePath) {
AptPackagingItem item =
new AptPackagingItem(sdkPath, manifestFile, resPackagePath, outputPath, generateSignedApk, releaseBuild, module);
new AptPackagingItem(sdkPath, manifestFile, resPackagePath, outputPath, generateSignedApk, releaseBuild, module, customKeystorePath);
item.setNativeLibsFolders(collectNativeLibsFolders(facet));
item.setClassesDexPath(classesDexPath);
item.setSourceRoots(sourceRoots);
@@ -227,8 +231,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
final Map<CompilerMessageCategory, List<String>> messages = AndroidApkBuilder
.execute(context.getProject(), resPackagePath, item.getClassesDexPath(), item.getSourceRoots(), externalLibPaths, item.getNativeLibsFolders(),
finalPath, unsigned, item.mySdkPath
);
finalPath, unsigned, item.mySdkPath, item.getCustomKeystorePath());
AndroidCompileUtil.addMessages(context, messages);
}
catch (final IOException e) {
@@ -289,6 +292,8 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
private final boolean myGenerateUnsigendApk;
private final Module myModule;
private boolean myReleaseBuild;
private final String myCustomKeystorePath;
private AptPackagingItem(String sdkPath,
@NotNull VirtualFile manifestFile,
@@ -296,7 +301,8 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
@NotNull String finalPath,
boolean generateUnsigendApk,
boolean releaseBuild,
@NotNull Module module) {
@NotNull Module module,
@Nullable String customKeystorePath) {
mySdkPath = sdkPath;
myManifestFile = manifestFile;
myResPackagePath = resPackagePath;
@@ -304,6 +310,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
myGenerateUnsigendApk = generateUnsigendApk;
myReleaseBuild = releaseBuild;
myModule = module;
myCustomKeystorePath = customKeystorePath;
}
@NotNull
@@ -321,6 +328,11 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
return myClassesDexPath;
}
@Nullable
public String getCustomKeystorePath() {
return myCustomKeystorePath;
}
@NotNull
public VirtualFile[] getNativeLibsFolders() {
return myNativeLibsFolders;
@@ -360,7 +372,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
@Nullable
public ValidityState getValidityState() {
return new MyValidityState(myResPackagePath, myClassesDexPath, myFinalPath, myGenerateUnsigendApk, myReleaseBuild,
mySourceRoots, myExternalLibraries, myNativeLibsFolders);
mySourceRoots, myExternalLibraries, myNativeLibsFolders, myCustomKeystorePath);
}
}
@@ -369,6 +381,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
private final String myApkPath;
private final boolean myGenerateUnsignedApk;
private final boolean myReleaseBuild;
private final String myCustomKeystorePath;
MyValidityState(DataInput is) throws IOException {
int size = is.readInt();
@@ -380,6 +393,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
myGenerateUnsignedApk = is.readBoolean();
myReleaseBuild = is.readBoolean();
myApkPath = is.readUTF();
myCustomKeystorePath = CompilerIOUtil.readString(is);
}
MyValidityState(String resPackagePath,
@@ -389,12 +403,14 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
boolean releaseBuild,
VirtualFile[] sourceRoots,
VirtualFile[] externalLibs,
VirtualFile[] nativeLibFolders) {
VirtualFile[] nativeLibFolders,
String customKeystorePath) {
myResourceTimestamps.put(FileUtil.toSystemIndependentName(resPackagePath), new File(resPackagePath).lastModified());
myResourceTimestamps.put(FileUtil.toSystemIndependentName(classesDexPath), new File(classesDexPath).lastModified());
myApkPath = apkPath;
myGenerateUnsignedApk = generateUnsignedApk;
myReleaseBuild = releaseBuild;
myCustomKeystorePath = customKeystorePath != null ? customKeystorePath : "";
final HashSet<VirtualFile> resourcesFromSourceRoot = new HashSet<VirtualFile>();
for (VirtualFile sourceRoot : sourceRoots) {
@@ -427,7 +443,8 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
return mvs.myGenerateUnsignedApk == myGenerateUnsignedApk &&
mvs.myReleaseBuild == myReleaseBuild &&
mvs.myResourceTimestamps.equals(myResourceTimestamps) &&
mvs.myApkPath.equals(myApkPath);
mvs.myApkPath.equals(myApkPath) &&
mvs.myCustomKeystorePath.equals(myCustomKeystorePath);
}
@Override
@@ -440,6 +457,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
out.writeBoolean(myGenerateUnsignedApk);
out.writeBoolean(myReleaseBuild);
out.writeUTF(myApkPath);
CompilerIOUtil.writeString(myCustomKeystorePath, out);
}
}
}
@@ -437,7 +437,7 @@ public class AndroidProguardCompiler implements ClassPostProcessingCompiler {
}
myConfigFileTimestamp = proguardConfigFile.getTimeStamp();
myLogsDirectoryPath = logsDirectoryOsPath;
myLogsDirectoryPath = logsDirectoryOsPath != null ? logsDirectoryOsPath : "";
}
private void fillClassFilesMap(VirtualFile file, Set<VirtualFile> visited) {
@@ -123,10 +123,11 @@ public class AndroidApkBuilder {
@NotNull VirtualFile[] nativeLibsFolders,
@NotNull String finalApk,
boolean unsigned,
@NotNull String sdkPath) throws IOException {
@NotNull String sdkPath,
@Nullable String customKeystorePath) throws IOException {
if (unsigned) {
return filterUsingKeystoreMessages(
finalPackage(project, dexPath, sourceRoots, externalJars, nativeLibsFolders, finalApk, resPackagePath, false));
finalPackage(project, dexPath, sourceRoots, externalJars, nativeLibsFolders, finalApk, resPackagePath, customKeystorePath, false));
}
final Map<CompilerMessageCategory, List<String>> map = new HashMap<CompilerMessageCategory, List<String>>();
@@ -136,7 +137,7 @@ public class AndroidApkBuilder {
Map<CompilerMessageCategory, List<String>> map2 = filterUsingKeystoreMessages(
finalPackage(project, dexPath, sourceRoots, externalJars, nativeLibsFolders, withAlignment ? unalignedApk : finalApk, resPackagePath,
true));
customKeystorePath, true));
map.putAll(map2);
if (withAlignment && map.get(ERROR).size() == 0) {
@@ -151,7 +152,9 @@ public class AndroidApkBuilder {
@NotNull VirtualFile[] sourceRoots,
@NotNull String[] externalJars,
@NotNull VirtualFile[] nativeLibsFolders,
@NotNull String outputApk, @NotNull String apkPath,
@NotNull String outputApk,
@NotNull String apkPath,
@Nullable String customKeystorePath,
boolean signed) {
final Map<CompilerMessageCategory, List<String>> result = new HashMap<CompilerMessageCategory, List<String>>();
result.put(ERROR, new ArrayList<String>());
@@ -161,7 +164,10 @@ public class AndroidApkBuilder {
FileOutputStream fos = null;
try {
String keyStoreOsPath = DebugKeyProvider.getDefaultKeyStoreOsPath();
String keyStoreOsPath = customKeystorePath != null && customKeystorePath.length() > 0
? customKeystorePath
: DebugKeyProvider.getDefaultKeyStoreOsPath();
DebugKeyProvider provider = createDebugKeyProvider(result, keyStoreOsPath);
X509Certificate certificate = signed ? (X509Certificate)provider.getCertificate() : null;
@@ -67,6 +67,8 @@ public class AndroidFacetConfiguration implements FacetConfiguration {
public boolean RUN_PROCESS_RESOURCES_MAVEN_TASK = true;
public boolean GENERATE_UNSIGNED_APK = false;
public String CUSTOM_DEBUG_KEYSTORE_PATH = "";
private AndroidFacet myFacet = null;
@@ -176,7 +176,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="3e085" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="3e085" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="4" bottom="0" right="0"/>
<constraints>
<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"/>
@@ -211,7 +211,7 @@
</component>
<component id="b01fc" class="javax.swing.JCheckBox" binding="myGenerateUnsignedApk">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" 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 resource-bundle="messages/AndroidBundle" key="android.facet.settings.generate.unsigned.apk"/>
@@ -232,6 +232,21 @@
</constraints>
<properties/>
</component>
<component id="e4bfd" class="com.intellij.ui.components.JBLabel" binding="myCustomKeystoreLabel">
<constraints>
<grid row="3" 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=""/>
<text resource-bundle="messages/AndroidBundle" key="android.facet.settings.custom.debug.keystore.label"/>
</properties>
</component>
<component id="c6091" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myCustomDebugKeystoreField">
<constraints>
<grid row="3" 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>
</children>
</grid>
<vspacer id="e716a">
@@ -28,11 +28,14 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.CollectionListModel;
import com.intellij.ui.ComboboxWithBrowseButton;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBList;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.HashSet;
@@ -98,6 +101,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
private JLabel myNativeLibsFolderLabel;
private JLabel myAidlGenPathLabel;
private JLabel myRGenPathLabel;
private TextFieldWithBrowseButton myCustomDebugKeystoreField;
private JBLabel myCustomKeystoreLabel;
public AndroidFacetEditorTab(FacetEditorContext context, AndroidFacetConfiguration androidFacetConfiguration) {
final Project project = context.getProject();
@@ -110,6 +115,7 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
myNativeLibsFolderLabel.setLabelFor(myNativeLibsFolder);
myAidlGenPathLabel.setLabelFor(myAidlGenPathField);
myRGenPathLabel.setLabelFor(myRGenPathField);
myCustomKeystoreLabel.setLabelFor(myCustomDebugKeystoreField);
AndroidFacet facet = (AndroidFacet)myContext.getFacet();
@@ -117,18 +123,24 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
myAidlGenPathField.getButton().addActionListener(new MyGenSourceFieldListener(myAidlGenPathField, facet.getAidlGenSourceRootPath()));
Module module = myContext.getModule();
myManifestFileField.getButton().addActionListener(new MyFolderFieldListener(myManifestFileField,
AndroidRootUtil.getManifestFile(module), true));
myManifestFileField.getButton().addActionListener(
new MyFolderFieldListener(myManifestFileField, AndroidRootUtil.getManifestFile(module), true, new MyManifestFilter()));
myResFolderField.getButton().addActionListener(new MyFolderFieldListener(myResFolderField,
AndroidRootUtil.getResourceDir(module), false));
AndroidRootUtil.getResourceDir(module), false, null));
myAssetsFolderField.getButton().addActionListener(new MyFolderFieldListener(myAssetsFolderField,
AndroidRootUtil.getAssetsDir(module), false));
AndroidRootUtil.getAssetsDir(module), false, null));
myNativeLibsFolder.getButton().addActionListener(new MyFolderFieldListener(myNativeLibsFolder,
AndroidRootUtil.getLibsDir(module), false));
AndroidRootUtil.getLibsDir(module), false, null));
myCustomAptSourceDirField.getButton().addActionListener(new MyFolderFieldListener(myCustomAptSourceDirField,
AndroidAptCompiler.getCustomResourceDirForApt(facet),
false));
false, null));
myCustomDebugKeystoreField.getButton().addActionListener(new MyFolderFieldListener(myCustomDebugKeystoreField, null, true, null));
myResetPathsButton.addActionListener(new ActionListener() {
@Override
@@ -183,7 +195,7 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
for (int i = 0; i < model.getSize(); i++) {
currentItems.add(model.getElementAt(i));
}
VirtualFile[] files = chooserDirsUnderModule(null, false, true);
VirtualFile[] files = chooserDirsUnderModule(null, false, true, null);
for (VirtualFile file : files) {
String newItem = FileUtil.toSystemDependentName(file.getPath());
if (!currentItems.contains(newItem)) {
@@ -312,6 +324,9 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
if (myGenerateUnsignedApk.isSelected() != myConfiguration.GENERATE_UNSIGNED_APK) {
return true;
}
if (!myConfiguration.CUSTOM_DEBUG_KEYSTORE_PATH.equals(getSelectedCustomKeystorePath())) {
return true;
}
List<String> currentResOverlayFolders = new ArrayList<String>();
for (String folder : myConfiguration.RES_OVERLAY_FOLDERS) {
@@ -333,6 +348,12 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
return !currentResOverlayFolders.equals(newResFolders);
}
@NotNull
private String getSelectedCustomKeystorePath() {
final String path = myCustomDebugKeystoreField.getText().trim();
return path.length() > 0 ? VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(path)) : "";
}
private boolean checkRelativePath(String relativePathFromConfig, String absPathFromTextField) {
String pathFromConfig = relativePathFromConfig;
if (pathFromConfig != null && pathFromConfig.length() > 0) {
@@ -424,6 +445,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
if (myConfiguration.LIBRARY_PROJECT != myIsLibraryProjectCheckbox.isSelected()) {
runApt = true;
}
myConfiguration.CUSTOM_DEBUG_KEYSTORE_PATH = getSelectedCustomKeystorePath();
myConfiguration.LIBRARY_PROJECT = myIsLibraryProjectCheckbox.isSelected();
@@ -537,6 +560,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
String libsAbsPath = libsPath.length() > 0 ? toAbsolutePath(libsPath) : "";
myNativeLibsFolder.setText(libsAbsPath != null ? libsAbsPath : "");
myCustomDebugKeystoreField.setText(FileUtil.toSystemDependentName(VfsUtil.urlToPath(configuration.CUSTOM_DEBUG_KEYSTORE_PATH)));
myGenerateRJavaWhenChanged.setSelected(configuration.REGENERATE_R_JAVA);
myGenerateIdlWhenChanged.setSelected(configuration.REGENERATE_JAVA_BY_AIDL);
@@ -646,12 +671,17 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
private class MyFolderFieldListener implements ActionListener {
private final TextFieldWithBrowseButton myTextField;
private final VirtualFile myDefaultDir;
private final boolean myManifest;
private final boolean myChooseFile;
private final Condition<VirtualFile> myFilter;
public MyFolderFieldListener(TextFieldWithBrowseButton textField, VirtualFile defaultDir, boolean manifest) {
public MyFolderFieldListener(TextFieldWithBrowseButton textField,
VirtualFile defaultDir,
boolean chooseFile,
@Nullable Condition<VirtualFile> filter) {
myTextField = textField;
myDefaultDir = defaultDir;
myManifest = manifest;
myChooseFile = chooseFile;
myFilter = filter;
}
@Override
@@ -665,7 +695,7 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
if (path != null) {
initialFile = LocalFileSystem.getInstance().findFileByPath(path);
}
VirtualFile[] files = chooserDirsUnderModule(initialFile, myManifest, false);
VirtualFile[] files = chooserDirsUnderModule(initialFile, myChooseFile, false, myFilter);
if (files.length > 0) {
assert files.length == 1;
myTextField.setText(FileUtil.toSystemDependentName(files[0].getPath()));
@@ -673,7 +703,10 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
}
}
private VirtualFile[] chooserDirsUnderModule(@Nullable VirtualFile initialFile, final boolean chooseManifest, boolean chooseMultiple) {
private VirtualFile[] chooserDirsUnderModule(@Nullable VirtualFile initialFile,
final boolean chooseFile,
boolean chooseMultiple,
@Nullable final Condition<VirtualFile> filter) {
if (initialFile == null) {
initialFile = myContext.getModule().getModuleFile();
}
@@ -684,14 +717,27 @@ public class AndroidFacetEditorTab extends FacetEditorTab {
}
}
return FileChooser
.chooseFiles(myContentPanel, new FileChooserDescriptor(chooseManifest, !chooseManifest, false, false, false, chooseMultiple) {
.chooseFiles(myContentPanel, new FileChooserDescriptor(chooseFile, !chooseFile, false, false, false, chooseMultiple) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
if (!super.isFileVisible(file, showHiddenFiles)) {
return false;
}
return file.isDirectory() || !chooseManifest || SdkConstants.FN_ANDROID_MANIFEST_XML.equals(file.getName());
if (!file.isDirectory() && !chooseFile) {
return false;
}
return filter == null || filter.value(file);
}
}, initialFile);
}
private static class MyManifestFilter implements Condition<VirtualFile> {
@Override
public boolean value(VirtualFile file) {
return file.isDirectory() || file.getName().equals(SdkConstants.FN_ANDROID_MANIFEST_XML);
}
}
}