diff --git a/.idea/libraries/miglayout_swing.xml b/.idea/libraries/miglayout_swing.xml index 5eced334efaa..03394158a644 100644 --- a/.idea/libraries/miglayout_swing.xml +++ b/.idea/libraries/miglayout_swing.xml @@ -1,11 +1,11 @@ - + - + \ No newline at end of file diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfigurable.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfigurable.java index e5e5115108a7..a7cd8a4d1f82 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfigurable.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfigurable.java @@ -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. @@ -49,7 +49,7 @@ public class JikesConfigurable implements Configurable { myPathField.getButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); - VirtualFile file = FileChooser.chooseFile(myPathField, descriptor, null); + VirtualFile file = FileChooser.chooseFile(descriptor, myPathField, null, null); if (file != null) { myPathField.setText(file.getPath().replace('/', File.separatorChar)); } diff --git a/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java b/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java index b022493d0109..9b51826e6002 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java @@ -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. @@ -18,6 +18,7 @@ package com.intellij.compiler.options; import com.intellij.compiler.CompileServerManager; import com.intellij.compiler.CompilerConfiguration; import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; @@ -105,8 +106,8 @@ public class AnnotationProcessorsConfigurable implements SearchableConfigurable, myProcessorPathField = new TextFieldWithBrowseButton(new ActionListener() { public void actionPerformed(ActionEvent e) { - final VirtualFile[] files = - FileChooser.chooseFiles(myProcessorPathField, FileChooserDescriptorFactory.createAllButJarContentsDescriptor()); + final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createAllButJarContentsDescriptor(); + final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myProcessorPathField, myProject, null); if (files.length > 0) { final StringBuilder builder = new StringBuilder(); for (VirtualFile file : files) { diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyElementType.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyElementType.java index c92e6be88b2b..1c709ea2d8c0 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyElementType.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyElementType.java @@ -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. @@ -53,7 +53,7 @@ public class DirectoryCopyElementType extends PackagingElementType chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact, @NotNull CompositePackagingElement parent) { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor(); - final VirtualFile[] files = FileChooser.chooseFiles(context.getProject(), descriptor); + final VirtualFile[] files = FileChooser.chooseFiles(descriptor, context.getProject(), null); final List list = new ArrayList(); for (VirtualFile file : files) { list.add(new DirectoryCopyPackagingElement(file.getPath())); diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryElementType.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryElementType.java index ab4c1e9efe34..833efd590b94 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryElementType.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryElementType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -15,9 +15,8 @@ */ package com.intellij.packaging.impl.elements; +import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserDialog; -import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.vfs.VirtualFile; @@ -63,8 +62,7 @@ public class ExtractedDirectoryElementType extends PackagingElementType> list = new ArrayList>(); final PackagingElementFactory factory = PackagingElementFactory.getInstance(); for (VirtualFile file : files) { diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyElementType.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyElementType.java index 675751389c75..b793db96bf1c 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyElementType.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyElementType.java @@ -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. @@ -15,9 +15,8 @@ */ package com.intellij.packaging.impl.elements; +import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserDialog; -import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.vfs.VirtualFile; @@ -55,8 +54,7 @@ public class FileCopyElementType extends PackagingElementType chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact, @NotNull CompositePackagingElement parent) { final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, true); - final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, context.getProject()); - final VirtualFile[] files = chooser.choose(null, context.getProject()); + final VirtualFile[] files = FileChooser.chooseFiles(descriptor, context.getProject(), null); final List list = new ArrayList(); for (VirtualFile file : files) { list.add(new FileCopyPackagingElement(file.getPath())); diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ManifestFileUtil.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ManifestFileUtil.java index 56e215103e98..2aa991e0b1fa 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ManifestFileUtil.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ManifestFileUtil.java @@ -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. @@ -261,7 +261,7 @@ public class ManifestFileUtil { public static VirtualFile showDialogAndCreateManifest(final ArtifactEditorContext context, final CompositePackagingElement element) { FileChooserDescriptor descriptor = createDescriptorForManifestDirectory(); final VirtualFile directory = suggestManifestFileDirectory(element, context, context.getArtifactType()); - final VirtualFile file = FileChooser.chooseFile(context.getProject(), descriptor, directory); + final VirtualFile file = FileChooser.chooseFile(descriptor, context.getProject(), directory); if (file == null) { return null; } diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/ui/properties/ElementWithManifestPropertiesPanel.java b/java/compiler/impl/src/com/intellij/packaging/impl/ui/properties/ElementWithManifestPropertiesPanel.java index d568c524ce8c..ad58d519b7c6 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/ui/properties/ElementWithManifestPropertiesPanel.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/ui/properties/ElementWithManifestPropertiesPanel.java @@ -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. @@ -105,7 +105,7 @@ public abstract class ElementWithManifestPropertiesPanel suitableDescriptors = new ArrayList(); @@ -167,8 +169,7 @@ public class CreateModuleLibraryChooser implements ClasspathElementChooser chosenRoots = RootDetectionUtil.detectRoots(Arrays.asList(files), myParentComponent, myModule.getProject(), - rootsComponentDescriptor); + List chosenRoots = RootDetectionUtil.detectRoots(Arrays.asList(files), myParentComponent, project, rootsComponentDescriptor); final List roots = filterAlreadyAdded(chosenRoots); if (roots.isEmpty()) { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesComponent.java index c2e2ad24d897..c0e3997ccafd 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/dependencyAnalysis/AnalyzeDependenciesComponent.java @@ -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. @@ -537,7 +537,7 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent { public CellAppearanceEx getAppearance(boolean selected, final boolean isBold) { return new CellAppearanceEx() { @Override - public void customize(SimpleColoredComponent component) { + public void customize(@NotNull SimpleColoredComponent component) { component.setIcon(getIcon()); final Font font = UIUtil.getTreeFont(); if (isBold) { @@ -557,6 +557,7 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent { throw new UnsupportedOperationException("Rendering in combo box not supported yet."); } + @NotNull @Override public String getText() { return getDisplayName(); @@ -618,7 +619,7 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent { if (e.getOwnerModule() == myModule) { return new CellAppearanceEx() { @Override - public void customize(SimpleColoredComponent component) { + public void customize(@NotNull SimpleColoredComponent component) { component.setIcon(ModuleType.get(myModule).getNodeIcon(false)); component.append("", SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); } @@ -628,6 +629,7 @@ public class AnalyzeDependenciesComponent extends MasterDetailsComponent { throw new UnsupportedOperationException("Rendering in combo box not supported yet."); } + @NotNull @Override public String getText() { return ""; diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java index 3a9daaa32146..5d49f97c8ba9 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java @@ -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. @@ -359,7 +359,7 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent if (myContextModule != null) { chooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myContextModule); } - final VirtualFile[] files = FileChooser.chooseFiles(myPanel, chooserDescriptor, initialSelection); + final VirtualFile[] files = FileChooser.chooseFiles(chooserDescriptor, myPanel, myProject, initialSelection); if (files.length == 0) return Collections.emptyList(); return RootDetectionUtil.detectRoots(Arrays.asList(files), myPanel, myProject, myDescriptor); diff --git a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java index a6790e8bb7e8..04d683ff2540 100644 --- a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java @@ -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. @@ -252,7 +252,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); descriptor.setTitle(ProjectBundle.message("external.annotations.root.chooser.title", entry.getPresentableName())); descriptor.setDescription(ProjectBundle.message("external.annotations.root.chooser.description")); - final VirtualFile file = FileChooser.chooseFile(project, descriptor); + final VirtualFile file = FileChooser.chooseFile(descriptor, project, null); if (file == null) { return; } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java index e1f28cd2b85a..dcace8ea4d10 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java @@ -96,6 +96,21 @@ public class ReferenceExpressionCompletionContributor { )); } + final PsiForeachStatement foreach = PsiTreeUtil.getParentOfType(element, PsiForeachStatement.class); + if (foreach != null && !PsiTreeUtil.isAncestor(foreach.getBody(), element, false)) { + return new ElementExtractorFilter(new ElementFilter() { + @Override + public boolean isAcceptable(Object element, @Nullable PsiElement context) { + return element != foreach.getIterationParameter(); + } + + @Override + public boolean isClassAcceptable(Class hintClass) { + return true; + } + }); + } + if (!allowRecursion) { final ElementFilter filter = RecursionWeigher.recursionFilter(element); if (filter != null) { diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesToNewDirectoryDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesToNewDirectoryDialog.java index 8a11a20021ac..4d1792cb9ee3 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesToNewDirectoryDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesToNewDirectoryDialog.java @@ -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. @@ -78,7 +78,7 @@ public class MoveClassesOrPackagesToNewDirectoryDialog extends DialogWrapper { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); myDestDirectoryField.getButton().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - final VirtualFile file = FileChooser.chooseFile(myDirectory.getProject(), descriptor, directory.getVirtualFile()); + final VirtualFile file = FileChooser.chooseFile(descriptor, myDirectory.getProject(), directory.getVirtualFile()); if (file != null) { myDestDirectoryField.setText(FileUtil.toSystemDependentName(file.getPath())); } diff --git a/java/java-psi-api/src/com/intellij/psi/PsiLiteralExpression.java b/java/java-psi-api/src/com/intellij/psi/PsiLiteralExpression.java index 53ca5783fa95..bf680e106ba6 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiLiteralExpression.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiLiteralExpression.java @@ -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. @@ -15,13 +15,8 @@ */ package com.intellij.psi; -import org.jetbrains.annotations.Nullable; - /** * Represents a Java literal expression. */ public interface PsiLiteralExpression extends PsiExpression, PsiLiteral { - /** @deprecated (to remove in IDEA 12) */ - @Nullable - String getParsingError(); } diff --git a/java/java-psi-api/src/com/intellij/psi/PsiType.java b/java/java-psi-api/src/com/intellij/psi/PsiType.java index fe442dac8ac5..5ed21bd5fdd0 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiType.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiType.java @@ -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. @@ -123,13 +123,6 @@ public abstract class PsiType implements PsiAnnotationOwner { return JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createTypeByFQClassName(CommonClassNames.JAVA_LANG_CLASS, resolveScope); } - /** - * @deprecated use {@linkplain #getJavaLangThrowable(PsiManager, com.intellij.psi.search.GlobalSearchScope)} (todo: to remove in IDEA 12) - */ - public static PsiClassType getJavaLangTrowable(PsiManager manager, GlobalSearchScope resolveScope) { - return getJavaLangThrowable(manager, resolveScope); - } - /** * Returns the class type for the java.lang.Throwable class. * diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsLiteralExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsLiteralExpressionImpl.java index d73610037b54..4c31f9f4fa94 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsLiteralExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsLiteralExpressionImpl.java @@ -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. @@ -52,11 +52,6 @@ public class ClsLiteralExpressionImpl extends ClsElementImpl implements PsiLiter return myText; } - @Override - public String getParsingError() { - return null; - } - @Override public void appendMirrorText(final int indentLevel, final StringBuilder buffer) { buffer.append(getText()); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiForeachStatementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiForeachStatementImpl.java index 26f3545e22fa..ec3cfbcd1127 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiForeachStatementImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiForeachStatementImpl.java @@ -134,7 +134,7 @@ public class PsiForeachStatementImpl extends CompositePsiElement implements PsiF @Override public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) { processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this); - if (lastParent == null || lastParent.getParent() != this || lastParent == getIteratedValue()) + if (lastParent == null || lastParent.getParent() != this /*|| lastParent == getIteratedValue()*/) // Parent element should not see our vars return true; diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLiteralExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLiteralExpressionImpl.java index 297e1b97eab0..53cc1246dba5 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLiteralExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLiteralExpressionImpl.java @@ -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. @@ -217,11 +217,6 @@ public class PsiLiteralExpressionImpl return integer; } - @Override - public String getParsingError() { - return null; - } - @Nullable private static String internedParseStringCharacters(final String chars) { final StringBuilder outChars = new StringBuilder(chars.length()); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/LocalVariableInitialization.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/LocalVariableInitialization.java index 7b6e40003652..dddaa1dc4e51 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/LocalVariableInitialization.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/LocalVariableInitialization.java @@ -181,7 +181,7 @@ public class a { } void forEachParam(java.io.File x) { - for (java.io.File f: f.listFiles()) { + for (java.io.File f: f.listFiles()) { forEachParam(f); } } diff --git a/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java b/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java index 0be6fc5081cb..50789eb52802 100644 --- a/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java +++ b/java/openapi/src/com/intellij/codeInsight/daemon/GroupNames.java @@ -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. @@ -67,15 +67,4 @@ public interface GroupNames { String JAVAEE_GROUP_NAME = InspectionsBundle.message("group.names.javaee.issues"); String CONCURRENCY_ANNOTATION_ISSUES = InspectionsBundle.message("group.names.concurrency.annotation.issues"); String JAVADOC_GROUP_NAME = InspectionsBundle.message("group.names.javadoc.issues"); - - /** @deprecated use #CLASS_LAYOUT_GROUP_NAME (todo: remove in IDEA 12) */ - String CLASSLAYOUT_GROUP_NAME = CLASS_LAYOUT_GROUP_NAME; - /** @deprecated use #CLASS_METRICS_GROUP_NAME (todo: remove in IDEA 12) */ - String CLASSMETRICS_GROUP_NAME = CLASS_METRICS_GROUP_NAME; - /** @deprecated use #ERROR_HANDLING_GROUP_NAME (todo: remove in IDEA 12) */ - String ERRORHANDLING_GROUP_NAME = ERROR_HANDLING_GROUP_NAME; - /** @deprecated use #METHOD_METRICS_GROUP_NAME (todo: remove in IDEA 12) */ - String METHODMETRICS_GROUP_NAME = METHOD_METRICS_GROUP_NAME; - /** @deprecated use #LANGUAGE_LEVEL_SPECIFIC_GROUP_NAME (todo: remove in IDEA 12) */ - String JDK15_SPECIFIC_GROUP_NAME = LANGUAGE_LEVEL_SPECIFIC_GROUP_NAME; } diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java index 122f5efce2eb..202d0476bf57 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java @@ -212,13 +212,6 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica return false; } - /** @deprecated use {@linkplain #getCanonicalFile()} (to remove in IDEA 12) */ - @SuppressWarnings({"MethodMayBeStatic", "UnusedDeclaration"}) - @Nullable - public String resolveSymLink() { - return null; - } - /** * Checks whether this file is a special (e.g. FIFO or device) file. * diff --git a/platform/lang-api/src/com/intellij/codeInspection/IntentionProvider.java b/platform/lang-api/src/com/intellij/codeInspection/IntentionProvider.java deleted file mode 100644 index 41e58651b7fe..000000000000 --- a/platform/lang-api/src/com/intellij/codeInspection/IntentionProvider.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.codeInspection; - -import com.intellij.codeInsight.intention.IntentionAction; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; - -/** @deprecated (to remove in IDEA 12) */ -public interface IntentionProvider { - @NotNull - Collection getIntentions(); -} diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java index 374c5adc6c39..7db6ea3ef324 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java @@ -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. @@ -177,13 +177,11 @@ public class PathEditor { private VirtualFile[] doAdd() { VirtualFile baseDir = myAddBaseDir; - if (baseDir == null) { - Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel)); - if (project != null) { - baseDir = project.getBaseDir(); - } + Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myPanel)); + if (baseDir == null && project != null) { + baseDir = project.getBaseDir(); } - VirtualFile[] files = FileChooser.chooseFiles(myPanel, myDescriptor, baseDir); + VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myPanel, project, baseDir); files = adjustAddedFileSet(myPanel, files); List added = new ArrayList(files.length); for (VirtualFile vFile : files) { diff --git a/platform/lang-api/src/com/intellij/openapi/roots/ui/util/OrderEntryCellAppearanceUtils.java b/platform/lang-api/src/com/intellij/openapi/roots/ui/util/OrderEntryCellAppearanceUtils.java deleted file mode 100644 index 1f08b56986c7..000000000000 --- a/platform/lang-api/src/com/intellij/openapi/roots/ui/util/OrderEntryCellAppearanceUtils.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.openapi.roots.ui.util; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleType; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectBundle; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.*; -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.openapi.roots.ui.FileAppearanceService; -import com.intellij.openapi.roots.ui.LightFilePointer; -import com.intellij.openapi.util.IconLoader; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.*; -import com.intellij.ui.SimpleTextAttributes; -import com.intellij.util.PathUtil; -import com.intellij.util.PlatformIcons; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.awt.*; -import java.io.File; - -/** - * @deprecated please use {@linkplain com.intellij.openapi.roots.ui.OrderEntryAppearanceService} (to remove in IDEA 12) - */ -@SuppressWarnings("UnusedDeclaration") -public class OrderEntryCellAppearanceUtils { - public static final Icon EXCLUDE_FOLDER_ICON = IconLoader.getDisabledIcon(PlatformIcons.FOLDER_ICON); - public static final Icon GENERIC_JDK_ICON = IconLoader.getIcon("/general/jdk.png"); - public static final String NO_JDK = ProjectBundle.message("jdk.missing.item"); - - private OrderEntryCellAppearanceUtils() { } - - public static CellAppearance forOrderEntry(OrderEntry orderEntry, boolean selected) { - if (orderEntry instanceof JdkOrderEntry) { - JdkOrderEntry jdkLibraryEntry = (JdkOrderEntry)orderEntry; - Sdk jdk = jdkLibraryEntry.getJdk(); - if (!orderEntry.isValid()) { - final String oldJdkName = jdkLibraryEntry.getJdkName(); - return FileAppearanceService.getInstance().forInvalidUrl(oldJdkName != null ? oldJdkName : NO_JDK); - } - return forJdk(jdk, false, selected); - } - else if (!orderEntry.isValid()) { - return FileAppearanceService.getInstance().forInvalidUrl(orderEntry.getPresentableName()); - } - else if (orderEntry instanceof LibraryOrderEntry) { - LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)orderEntry; - final Library library = libraryOrderEntry.getLibrary(); - if (!libraryOrderEntry.isValid()){ //library can be removed - return FileAppearanceService.getInstance().forInvalidUrl(orderEntry.getPresentableName()); - } - return forLibrary(library); - } - else if (orderEntry.isSynthetic()) { - String presentableName = orderEntry.getPresentableName(); - Icon icon = orderEntry instanceof ModuleSourceOrderEntry ? sourceFolderIcon(false) : null; - return new SimpleTextCellAppearance(presentableName, icon, SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); - } - else if (orderEntry instanceof ModuleOrderEntry) { - final Icon icon = ModuleType.get(((ModuleOrderEntry)orderEntry).getModule()).getNodeIcon(false); - return SimpleTextCellAppearance.regular(orderEntry.getPresentableName(), icon); - } - else return CompositeAppearance.single(orderEntry.getPresentableName()); - } - - public static CellAppearance forLibrary(Library library) { - return forLibrary(library, false); - } - - public static CellAppearance forLibrary(Library library, final boolean hasInvalidRoots) { - String name = library.getName(); - if (name != null) { - return normalOrRedWaved(name, PlatformIcons.LIBRARY_ICON, hasInvalidRoots); - } - String[] files = library.getUrls(OrderRootType.CLASSES); - if (files.length == 0) { - return SimpleTextCellAppearance.invalid(ProjectBundle.message("library.empty.library.item"), PlatformIcons.LIBRARY_ICON); - } - if (files.length == 1) { - return forVirtualFilePointer(new LightFilePointer(files[0])); - } - String url = StringUtil.trimEnd(files[0], JarFileSystem.JAR_SEPARATOR); - return SimpleTextCellAppearance.regular(PathUtil.getFileName(url), PlatformIcons.LIBRARY_ICON); - } - - public static CellAppearance normalOrRedWaved(String text, final Icon icon, boolean waved) { - if (waved) { - return new SimpleTextCellAppearance(text, icon, new SimpleTextAttributes(SimpleTextAttributes.STYLE_WAVED, null, Color.RED)); - } - return SimpleTextCellAppearance.regular(text, icon); - } - - public static Icon sourceFolderIcon(boolean testSource) { - return testSource ? PlatformIcons.TEST_SOURCE_FOLDER : PlatformIcons.SOURCE_FOLDERS_ICON; - } - - public static ModifiableCellAppearance forJdk(@Nullable Sdk jdk, boolean isInComboBox, final boolean selected, final boolean showVersion) { - if (jdk == null) { - return (ModifiableCellAppearance)FileAppearanceService.getInstance().forInvalidUrl(NO_JDK); - } - String name = jdk.getName(); - CompositeAppearance appearance = new CompositeAppearance(); - appearance.setIcon(jdk.getSdkType().getIcon()); - VirtualFile homeDirectory = jdk.getHomeDirectory(); - SimpleTextAttributes attributes = homeDirectory != null && homeDirectory.isValid() - ? CellAppearanceUtils.createSimpleCellAttributes(selected) : SimpleTextAttributes.ERROR_ATTRIBUTES; - CompositeAppearance.DequeEnd ending = appearance.getEnding(); - ending.addText(name, attributes); - if (showVersion) { - String versionString = jdk.getVersionString(); - if (versionString != null && !versionString.equals(name)) { - SimpleTextAttributes textAttributes = isInComboBox - ? SimpleTextAttributes.SYNTHETIC_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES; - ending.addComment(versionString, textAttributes); - } - } - return ending.getAppearance(); - } - - public static CellAppearance forJdk(@Nullable Sdk jdk, boolean isInComboBox, final boolean selected) { - return forJdk(jdk, isInComboBox, selected, true); - } - - public static SimpleTextCellAppearance forSourceFolder(SourceFolder folder) { - return formatRelativePath(folder, PlatformIcons.FOLDER_ICON); - } - - public static CellAppearance forExcludeFolder(ExcludeFolder folder) { - return formatRelativePath(folder, EXCLUDE_FOLDER_ICON); - } - - public static CellAppearance forContentFolder(ContentFolder folder) { - if (folder instanceof SourceFolder) { - return forSourceFolder((SourceFolder)folder); - } - else if (folder instanceof ExcludeFolder) { - return forExcludeFolder((ExcludeFolder)folder); - } - else { - throw new RuntimeException(folder.getClass().getName()); - } - } - - public static CellAppearance forModule(Module module) { - return SimpleTextCellAppearance.regular(module.getName(), ModuleType.get(module).getNodeIcon(false)); - } - - public static CellAppearance forContentEntry(ContentEntry contentEntry) { - return forVirtualFilePointer(new LightFilePointer(contentEntry.getUrl())); - } - - public static SimpleTextCellAppearance formatRelativePath(ContentFolder folder, Icon icon) { - LightFilePointer folderFile = new LightFilePointer(folder.getUrl()); - VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(folder.getContentEntry().getUrl()); - if (file == null) return (SimpleTextCellAppearance)FileAppearanceService.getInstance().forInvalidUrl(folderFile.getPresentableUrl()); - String contentPath = file.getPath(); - String relativePath; - SimpleTextAttributes textAttributes; - if (!folderFile.isValid()) { - textAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES; - String absolutePath = folderFile.getPresentableUrl(); - relativePath = absolutePath.startsWith(contentPath) ? absolutePath.substring(contentPath.length()) : absolutePath; - } - else { - relativePath = VfsUtilCore.getRelativePath(folderFile.getFile(), file, File.separatorChar); - textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES; - } - if (relativePath == null) relativePath = ""; - relativePath = relativePath.length() == 0 ? "." + File.separatorChar : relativePath; - return new SimpleTextCellAppearance(relativePath, icon, textAttributes); - } - - public static CellAppearance forProjectJdk(final Project project) { - final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project); - final Sdk projectJdk = projectRootManager.getProjectSdk(); - final CellAppearance appearance; - if (projectJdk != null) { - appearance = forJdk(projectJdk, false, false); - } - else { - // probably invalid JDK - final String projectJdkName = projectRootManager.getProjectSdkName(); - if (projectJdkName != null) { - appearance = FileAppearanceService.getInstance().forInvalidUrl(ProjectBundle.message("jdk.combo.box.invalid.item", projectJdkName)); - } - else { - appearance = forJdk(null, false, false); - } - } - return appearance; - } - - public static CellAppearance forVirtualFilePointer(LightFilePointer filePointer) { - final VirtualFile file = filePointer.getFile(); - return file != null ? FileAppearanceService.getInstance().forVirtualFile(file) - : FileAppearanceService.getInstance().forInvalidUrl(filePointer.getPresentableUrl()); - } -} diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java index 2b49d863d81d..1c4953ab7337 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java @@ -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. @@ -82,7 +82,7 @@ public class ViewOfflineResultsAction extends AnAction implements DumbAware { LOG.assertTrue(project != null); - final VirtualFile virtualFile = FileChooser.chooseFile(project, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR); + final VirtualFile virtualFile = FileChooser.chooseFile(BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR, project, null); if (virtualFile == null || !virtualFile.isDirectory()) return; final Map>> resMap = diff --git a/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java b/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java index 3a12e8ad5db4..e70359491b0f 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -70,7 +70,7 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc protected void initComponents() { myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), - ExecutionBundle.message("run.configuration.program.parameters")); + ExecutionBundle.message("run.configuration.program.parameters")); final JPanel panel = new JPanel(new BorderLayout()); myWorkingDirectoryField = new TextFieldWithBrowseButton(new ActionListener() { @@ -78,7 +78,8 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message")); fileChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myModuleContext); - VirtualFile file = FileChooser.chooseFile(myWorkingDirectoryComponent, fileChooserDescriptor, null); + Project project = myModuleContext != null ? myModuleContext.getProject() : null; + VirtualFile file = FileChooser.chooseFile(fileChooserDescriptor, myWorkingDirectoryComponent, project, null); if (file != null) { setWorkingDirectory(file.getPresentableUrl()); } diff --git a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java index cd2fb1e1483f..dc416f66aca0 100644 --- a/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/framework/detection/impl/exclude/DetectionExcludesConfigurable.java @@ -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. @@ -199,7 +199,7 @@ public class DetectionExcludesConfigurable implements Configurable { private void chooseDirectoryAndAdd(final @Nullable FrameworkType type) { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); descriptor.setDescription((type != null ? type.getPresentableName() + " framework detection" : "Detection for all frameworks") + " will be disabled in selected directory"); - final VirtualFile[] files = FileChooser.chooseFiles(myMainPanel, descriptor, myProject.getBaseDir()); + final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myMainPanel, myProject, myProject.getBaseDir()); final VirtualFile file = files.length > 0 ? files[0] : null; if (file != null) { addAndRemoveDuplicates(type, file); diff --git a/platform/lang-impl/src/com/intellij/ide/macro/FilePromptMacro.java b/platform/lang-impl/src/com/intellij/ide/macro/FilePromptMacro.java index 7346a6865e00..fa6b49633674 100644 --- a/platform/lang-impl/src/com/intellij/ide/macro/FilePromptMacro.java +++ b/platform/lang-impl/src/com/intellij/ide/macro/FilePromptMacro.java @@ -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. @@ -18,10 +18,7 @@ package com.intellij.ide.macro; import com.intellij.ide.IdeBundle; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.PlatformDataKeys; -import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; -import com.intellij.openapi.fileChooser.FileChooserDialog; -import com.intellij.openapi.fileChooser.FileChooserFactory; +import com.intellij.openapi.fileChooser.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; @@ -43,8 +40,7 @@ public class FilePromptMacro extends PromptingMacro implements SecondQueueExpand protected String promptUser(DataContext dataContext) { Project project = PlatformDataKeys.PROJECT.getData(dataContext); final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor(); - final FileChooserDialog fileChooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project); - final VirtualFile[] result = fileChooser.choose(null, project); + final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, null); return result.length == 1? FileUtil.toSystemDependentName(result[0].getPath()) : null; } diff --git a/platform/lang-impl/src/com/intellij/internal/DumpIntentionsAction.java b/platform/lang-impl/src/com/intellij/internal/DumpIntentionsAction.java index ba8305d1b4c8..12a7be843102 100644 --- a/platform/lang-impl/src/com/intellij/internal/DumpIntentionsAction.java +++ b/platform/lang-impl/src/com/intellij/internal/DumpIntentionsAction.java @@ -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. @@ -49,7 +49,7 @@ public class DumpIntentionsAction extends AnAction implements DumbAware { @Override public void actionPerformed(AnActionEvent e) { final VirtualFile file = - FileChooser.chooseFile(e.getData(PlatformDataKeys.PROJECT), FileChooserDescriptorFactory.createSingleFolderDescriptor(), null); + FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), e.getData(PlatformDataKeys.PROJECT), null); if (file != null) { final List list = IntentionManagerSettings.getInstance().getMetaData(); final File root = VfsUtil.virtualToIoFile(file); diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTypeServiceImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTypeServiceImpl.java index 60d7059e40c6..84fe7b88231b 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTypeServiceImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTypeServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -60,7 +60,7 @@ public class LibraryTypeServiceImpl extends LibraryTypeService { final Project project) { final FileChooserDescriptor chooserDescriptor = descriptor.createAttachFilesChooserDescriptor(); chooserDescriptor.setTitle("Select Library Files"); - final VirtualFile[] rootCandidates = FileChooser.chooseFiles(parentComponent, chooserDescriptor, contextDirectory); + final VirtualFile[] rootCandidates = FileChooser.chooseFiles(chooserDescriptor, parentComponent, project, contextDirectory); if (rootCandidates.length == 0) { return null; } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/ChooserBasedAttachRootButtonDescriptor.java b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/ChooserBasedAttachRootButtonDescriptor.java index 4e4de9a2826d..b6f4e4c041ea 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/ChooserBasedAttachRootButtonDescriptor.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/ChooserBasedAttachRootButtonDescriptor.java @@ -1,9 +1,12 @@ /* - * Copyright 2000-2010 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. * 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. @@ -49,6 +52,6 @@ public abstract class ChooserBasedAttachRootButtonDescriptor extends AttachRootB if (contextModule != null) { chooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, contextModule); } - return FileChooser.chooseFiles(parent, chooserDescriptor, initialSelection); + return FileChooser.chooseFiles(chooserDescriptor, parent, contextModule != null ? contextModule.getProject() : null, initialSelection); } } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java index 9b0db57dd926..6f84cd1c8266 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/ContentEntryEditor.java @@ -262,14 +262,6 @@ public abstract class ContentEntryEditor implements ContentRootPanel.ActionCallb } } - /** @deprecated use {@linkplain #doRemoveExcludeFolder(com.intellij.openapi.roots.ExcludeFolder)} (to remove in IDEA 12) */ - protected void doRemoveExcludeFolder(ExcludeFolder excludeFolder, VirtualFile file) { - if (!excludeFolder.isSynthetic()) { - final ContentEntry contentEntry = getContentEntry(); - if (contentEntry != null) contentEntry.removeExcludeFolder(excludeFolder); - } - } - public boolean isSource(@NotNull final VirtualFile file) { final SourceFolder sourceFolder = getSourceFolder(file); return sourceFolder != null && !sourceFolder.isTestSource(); diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java index f97a5e122cb1..d8c97a0c7837 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java @@ -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. @@ -41,6 +41,7 @@ import com.intellij.openapi.options.BaseConfigurable; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.options.SearchableConfigurable; +import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.*; @@ -119,6 +120,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple } }); + final Project project = projectProfileManager.getProject(); myImportButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false){ @@ -128,7 +130,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple } }; descriptor.setDescription("Choose profile file"); - final VirtualFile file = FileChooser.chooseFile(myWholePanel, descriptor, null); + final VirtualFile file = FileChooser.chooseFile(descriptor, myWholePanel, project, null); if (file == null) return; InspectionProfileImpl profile = new InspectionProfileImpl("TempProfile", InspectionToolRegistrar.getInstance(), myProfileManager); @@ -193,7 +195,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple public void actionPerformed(ActionEvent e) { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); descriptor.setDescription("Choose directory to store profile file"); - final VirtualFile file = FileChooser.chooseFile(myWholePanel, descriptor, null); + final VirtualFile file = FileChooser.chooseFile(descriptor, myWholePanel, project, null); if (file == null) return; final Element element = new Element("inspections"); try { diff --git a/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java b/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java index ce991c7eb246..7c4055402403 100644 --- a/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java +++ b/platform/lang-impl/src/com/intellij/tools/ToolEditorDialog.java @@ -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. @@ -197,7 +197,7 @@ public class ToolEditorDialog extends DialogWrapper { new ActionListener() { public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); - VirtualFile file = FileChooser.chooseFile(myProject, descriptor, null); + VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file != null) { myTfCommand.setText(file.getPresentableUrl()); String workingDirectory = myTfCommandWorkingDirectory.getText(); @@ -276,7 +276,7 @@ public class ToolEditorDialog extends DialogWrapper { new ActionListener() { public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); - VirtualFile file = FileChooser.chooseFile(myProject, descriptor); + VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file != null) { myTfCommandWorkingDirectory.setText(file.getPresentableUrl()); } diff --git a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java index 1c1513a594fa..6ca9a05dfc58 100644 --- a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java +++ b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java @@ -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. @@ -177,7 +177,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta public void actionPerformed(AnActionEvent e) { if (pathToFile() == null) { - VirtualFile selectedFile = FileChooser.chooseFile(myComponent, FILE_DESCRIPTOR, null); + VirtualFile selectedFile = FileChooser.chooseFile(FILE_DESCRIPTOR, myComponent, getEventProject(e), null); if (selectedFile != null) { myState.currentScript = selectedFile.getPresentableUrl(); myCurrentScript.setText(myState.currentScript); @@ -218,7 +218,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta @Override public void actionPerformed(AnActionEvent e) { - VirtualFile selectedFile = FileChooser.chooseFile(myComponent, FILE_DESCRIPTOR, pathToFile()); + VirtualFile selectedFile = FileChooser.chooseFile(FILE_DESCRIPTOR, myComponent, getEventProject(e), pathToFile()); if (selectedFile != null) { myState.currentScript = selectedFile.getPresentableUrl(); loadFrom(selectedFile); diff --git a/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java b/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java index 76b4f6811259..1fc41f0cf8ae 100644 --- a/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java +++ b/platform/lang-impl/src/com/intellij/util/download/impl/FileDownloaderImpl.java @@ -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. @@ -177,16 +177,8 @@ public class FileDownloaderImpl implements FileDownloader { private VirtualFile chooseDirectoryForFiles() { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); descriptor.setTitle(IdeBundle.message("dialog.directory.for.downloaded.files.title")); - - final VirtualFile file; - if (myProject != null) { - file = FileChooser.chooseFile(myProject, descriptor, myProject.getBaseDir()); - } - else { - file = FileChooser.chooseFile(myParent, descriptor, null); - } - - return file; + final VirtualFile baseDir = myProject != null ? myProject.getBaseDir() : null; + return FileChooser.chooseFile(descriptor, myParent, myProject, baseDir); } @NotNull diff --git a/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java b/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java index c74ba25e0ee3..e53644ba53d5 100644 --- a/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java +++ b/platform/platform-api/src/com/intellij/codeInsight/highlighting/TooltipLinkHandler.java @@ -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. @@ -19,20 +19,10 @@ import com.intellij.openapi.editor.Editor; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.*; - /** * @author peter */ public abstract class TooltipLinkHandler { - /** - * @deprecated use {@link #handleLink(String, com.intellij.openapi.editor.Editor)} (to remove in IDEA 12) - */ - @SuppressWarnings("UnusedDeclaration") - public void handleLink(@NotNull String refSuffix, @NotNull Editor editor, @NotNull JEditorPane tooltip) { - handleLink(refSuffix, editor); - } - /** * Override to handle mouse clicks on a link. * diff --git a/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java b/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java index 60c7154d1da4..0d59afede2d8 100644 --- a/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java +++ b/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java @@ -141,14 +141,6 @@ public class GeneralCommandLine implements UserDataHolder { myRedirectErrorStream = redirectErrorStream; } - /** - * @deprecated please use {@link #getCommandLineString()} (to remove in IDEA 12). - */ - @SuppressWarnings("UnusedDeclaration") - public String getCommandLineParams() { - return getCommandLineString(); - } - /** * Returns string representation of this command line.
* Warning: resulting string is not OS-dependent - do not use it for executing this command line. @@ -182,30 +174,14 @@ public class GeneralCommandLine implements UserDataHolder { } /** - * Returns a list of command and its parameters prepared in OS-dependent way to be executed by e.g. {@link Runtime#exec(String[])}. + * Prepares command (quotes and escapes all arguments) and returns it as a newline-separated list + * (suitable e.g. for passing in a environment variable). * - * @deprecated this method is not intended for internal use (to remove in IDEA 12). + * @return command as a newline-separated list. */ - public String[] getCommands() { - return prepareCommands(); - } - - /** - * @deprecated use {@link #addParameter(String)} and {@link #addParameters(String...)} methods for adding parameters - - * any quoting needed will be done on {@link #createProcess()} (to remove in IDEA 12). - */ - @SuppressWarnings("UnusedDeclaration") - public static String quoteParameter(final String parameter) { - return parameter; - } - - /** - * @deprecated use {@link #addParameter(String)} and {@link #addParameters(String...)} methods for adding parameters - - * any quoting needed will be done on {@link #createProcess()} (to remove in IDEA 12). - */ - @SuppressWarnings("UnusedDeclaration") - public static String quote(final String parameter) { - return parameter; + @NotNull + public String getPreparedCommandLine() { + return StringUtil.join(prepareCommands(), "\n"); } public Process createProcess() throws ExecutionException { diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java index 89a71fcb9682..68e11de23454 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java @@ -17,7 +17,6 @@ package com.intellij.openapi.fileChooser; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; @@ -33,48 +32,128 @@ public class FileChooser { private FileChooser() { } + /** + * @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") @NotNull public static VirtualFile[] chooseFiles(Project project, FileChooserDescriptor descriptor) { - return chooseFiles(project, descriptor, null); + return chooseFiles(descriptor, null, project, null); } + /** + * @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor, + * java.awt.Component, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") @NotNull public static VirtualFile[] chooseFiles(Component parent, FileChooserDescriptor descriptor) { - return chooseFiles(parent, descriptor, null); + return chooseFiles(descriptor, parent, null, null); + } + + /** + * @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") + @NotNull + public static VirtualFile[] chooseFiles(Project project, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) { + return chooseFiles(descriptor, null, project, toSelect); + } + + /** + * @deprecated use {@linkplain #chooseFiles(FileChooserDescriptor, + * java.awt.Component, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") + @NotNull + public static VirtualFile[] chooseFiles(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) { + return chooseFiles(descriptor, parent, null, toSelect); } @NotNull - public static VirtualFile[] chooseFiles(Project project, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) { - FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project); + public static VirtualFile[] chooseFiles(@NotNull final FileChooserDescriptor descriptor, + @Nullable final Project project, + @Nullable final VirtualFile toSelect) { + return chooseFiles(descriptor, null, project, toSelect); + } + + @NotNull + public static VirtualFile[] chooseFiles(@NotNull final FileChooserDescriptor descriptor, + @Nullable final Component parent, + @Nullable final Project project, + @Nullable final VirtualFile toSelect) { + final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, parent); return chooser.choose(toSelect, project); } - @NotNull - public static VirtualFile[] chooseFiles(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) { - FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, parent); - return chooser.choose(toSelect, null); - } - + /** + * @deprecated use {@linkplain #chooseFile(FileChooserDescriptor, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") @Nullable public static VirtualFile chooseFile(Project project, FileChooserDescriptor descriptor) { - return chooseFile(project, descriptor, null); + return chooseFile(descriptor, null, project, null); } + /** + * @deprecated use {@linkplain #chooseFile(FileChooserDescriptor, + * java.awt.Component, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") @Nullable public static VirtualFile chooseFile(Component parent, FileChooserDescriptor descriptor) { - return chooseFile(parent, descriptor, null); + return chooseFile(descriptor, parent, null, null); } + /** + * @deprecated use {@linkplain #chooseFile(FileChooserDescriptor, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") @Nullable public static VirtualFile chooseFile(Project project, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) { - LOG.assertTrue(!descriptor.isChooseMultiple()); - return ArrayUtil.getFirstElement(chooseFiles(project, descriptor, toSelect)); + return chooseFile(descriptor, null, project, toSelect); + } + + /** + * @deprecated use {@linkplain #chooseFile(FileChooserDescriptor, + * java.awt.Component, + * com.intellij.openapi.project.Project, + * com.intellij.openapi.vfs.VirtualFile)} (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") + @Nullable + public static VirtualFile chooseFile(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) { + return chooseFile(descriptor, parent, null, toSelect); } @Nullable - public static VirtualFile chooseFile(Component parent, FileChooserDescriptor descriptor, @Nullable VirtualFile toSelect) { + public static VirtualFile chooseFile(@NotNull final FileChooserDescriptor descriptor, + @Nullable final Project project, + @Nullable final VirtualFile toSelect) { + return chooseFile(descriptor, null, project, toSelect); + } + + @Nullable + public static VirtualFile chooseFile(@NotNull final FileChooserDescriptor descriptor, + @Nullable final Component parent, + @Nullable final Project project, + @Nullable final VirtualFile toSelect) { LOG.assertTrue(!descriptor.isChooseMultiple()); - return ArrayUtil.getFirstElement(chooseFiles(parent, descriptor, toSelect)); + return ArrayUtil.getFirstElement(chooseFiles(descriptor, parent, project, toSelect)); } /** @@ -154,11 +233,4 @@ public class FileChooser { final PathChooserDialog pathChooser = factory.createPathChooser(descriptor, project, parent); pathChooser.choose(toSelect, callback); } - - /** @deprecated internal method, to remove in IDEA 12 */ - @SuppressWarnings("UnusedDeclaration") - public static boolean isNativeMacChooserEnabled() { - return "true".equalsIgnoreCase(System.getProperty("native.mac.file.chooser.enabled", "true")) && - Registry.is("ide.mac.filechooser.native"); - } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java index d4b150d8dd76..d69b4c68c2bb 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptor.java @@ -76,19 +76,6 @@ public class FileChooserDescriptor implements Cloneable { myChooseMultiple = chooseMultiple; } - /** @deprecated use {@linkplain FileChooserDescriptorFactory} (to remove in IDEA 12) */ - @SuppressWarnings("UnusedDeclaration") - public FileChooserDescriptor() { - this(false, false, false, false, false, false); - } - - /** @deprecated use {@linkplain FileChooserDescriptorFactory} (to remove in IDEA 12) */ - @SuppressWarnings("UnusedDeclaration") - public FileChooserDescriptor chooseFolders() { - myChooseFolders = true; - return this; - } - public final String getTitle() { return myTitle; } diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java index 8f3c48b775c2..0d47ad39462b 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserFactory.java @@ -29,11 +29,21 @@ public abstract class FileChooserFactory { return ServiceManager.getService(FileChooserFactory.class); } + /** + * @deprecated use {@linkplain #createFileChooser(FileChooserDescriptor, com.intellij.openapi.project.Project, java.awt.Component)} + * (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") @NotNull public FileChooserDialog createFileChooser(@NotNull FileChooserDescriptor descriptor, @Nullable Project project) { return createFileChooser(descriptor, project, null); } + /** + * @deprecated use {@linkplain #createFileChooser(FileChooserDescriptor, com.intellij.openapi.project.Project, java.awt.Component)} + * (to remove in IDEA 13) + */ + @SuppressWarnings("UnusedDeclaration") @NotNull public FileChooserDialog createFileChooser(@NotNull FileChooserDescriptor descriptor, @NotNull Component parent) { return createFileChooser(descriptor, null, parent); diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/MacFileChooserDialog.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/MacFileChooserDialog.java deleted file mode 100644 index 94ebfc23e5d7..000000000000 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/MacFileChooserDialog.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.openapi.fileChooser; - -import com.intellij.openapi.actionSystem.DataKey; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @deprecated use {@linkplain PathChooserDialog} (to remove in IDEA 12) - */ -@SuppressWarnings("UnusedDeclaration") -public interface MacFileChooserDialog extends FileChooserDialog { - DataKey NATIVE_MAC_FILE_CHOOSER_ENABLED = DataKey.create("native.mac.file.chooser.enabled"); - DataKey NATIVE_MAC_FILE_CHOOSER_SHOW_HIDDEN_FILES_ENABLED = PathChooserDialog.NATIVE_MAC_CHOOSER_SHOW_HIDDEN_FILES; - - void chooseWithSheet(@Nullable VirtualFile toSelect, @Nullable Project project, @NotNull final MacFileChooserCallback callback); - - interface MacFileChooserCallback { - void onChosen(@NotNull VirtualFile[] files); - } -} diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/CellAppearanceEx.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/CellAppearanceEx.java index bfc7d948c870..0d6a8fe95df9 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/CellAppearanceEx.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/CellAppearanceEx.java @@ -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. @@ -15,10 +15,15 @@ */ package com.intellij.openapi.roots.ui; -import com.intellij.openapi.roots.ui.util.CellAppearance; import com.intellij.ui.HtmlListCellRenderer; +import com.intellij.ui.SimpleColoredComponent; import org.jetbrains.annotations.NotNull; -public interface CellAppearanceEx extends CellAppearance { +public interface CellAppearanceEx { + @NotNull + String getText(); + void customize(@NotNull HtmlListCellRenderer renderer); + + void customize(@NotNull SimpleColoredComponent component); } diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java index 9799c8252a92..b2386f600103 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/BaseTextCommentCellAppearance.java @@ -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. @@ -52,6 +52,7 @@ public abstract class BaseTextCommentCellAppearance implements CellAppearanceEx } } + @NotNull public String getText() { String secondaryText = getSecondaryText(); if (secondaryText != null && secondaryText.length() > 0) { diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CellAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CellAppearance.java deleted file mode 100644 index 5e5cb447470c..000000000000 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CellAppearance.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.roots.ui.util; - -import com.intellij.ui.SimpleColoredComponent; - -/** - * @deprecated please use {@linkplain com.intellij.openapi.roots.ui.CellAppearanceEx} (to remove in IDEA 12). - */ -public interface CellAppearance { - void customize(SimpleColoredComponent component); - String getText(); -} diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CellAppearanceUtils.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CellAppearanceUtils.java deleted file mode 100644 index e7cadb792db4..000000000000 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CellAppearanceUtils.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.roots.ui.util; - -import com.intellij.ide.presentation.VirtualFilePresentation; -import com.intellij.openapi.fileTypes.FileType; -import com.intellij.openapi.fileTypes.FileTypeManager; -import com.intellij.openapi.roots.ui.FileAppearanceService; -import com.intellij.openapi.util.IconLoader; -import com.intellij.openapi.vfs.JarFileSystem; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.ui.SimpleTextAttributes; -import com.intellij.util.PlatformIcons; - -import javax.swing.*; -import java.io.File; - -/** - * @deprecated please use {@linkplain com.intellij.openapi.roots.ui.FileAppearanceService} (to remove in IDEA 12) - */ -@SuppressWarnings("UnusedDeclaration") -public class CellAppearanceUtils { - public static final Icon INVALID_ICON = PlatformIcons.INVALID_ENTRY_ICON; - public static final CellAppearance EMPTY = FileAppearanceService.getInstance().empty(); - - private CellAppearanceUtils() { } - - public static SimpleTextAttributes createSimpleCellAttributes(boolean isSelected) { - return isSelected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES; - } - - public static CellAppearance forVirtualFile(VirtualFile virtualFile) { - return FileAppearanceService.getInstance().forVirtualFile(virtualFile); - } - - public static CellAppearance forValidVirtualFile(VirtualFile virtualFile) { - return FileAppearanceService.getInstance().forVirtualFile(virtualFile); - } - - public static Icon iconForFile(VirtualFile file) { - if (file.getFileSystem().getProtocol().equals(JarFileSystem.PROTOCOL) && file.getParent() == null) { - return VirtualFilePresentation.getIcon(file); - } - if (file.isDirectory()) return PlatformIcons.FOLDER_ICON; - return VirtualFilePresentation.getIcon(file); - } - - public static Icon excludeIcon(Icon icon) { - return IconLoader.getDisabledIcon(icon); - } - - public static CompositeAppearance forFile(File file) { - String absolutePath = file.getAbsolutePath(); - if (!file.exists()) return CompositeAppearance.invalid(absolutePath); - if (file.isDirectory()) { - CompositeAppearance appearance = CompositeAppearance.single(absolutePath); - appearance.setIcon(PlatformIcons.FOLDER_ICON); - return appearance; - } - String name = file.getName(); - FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(name); - File parent = file.getParentFile(); - CompositeAppearance appearance = CompositeAppearance.textComment(name, parent.getAbsolutePath()); - appearance.setIcon(fileType.getIcon()); - return appearance; - } -} diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java index 197618b84a1b..8ec0e75a36a2 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java @@ -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. @@ -31,14 +31,14 @@ import java.util.ArrayList; import java.util.Iterator; // todo: move to lang-impl ? -public class CompositeAppearance implements ModifiableCellAppearanceEx, ModifiableCellAppearance { +public class CompositeAppearance implements ModifiableCellAppearanceEx { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.ui.util.CompositeAppearance"); private Icon myIcon; private final ArrayList mySections = new ArrayList(); private int myInsertionIndex = 0; - public void customize(SimpleColoredComponent component) { + public void customize(@NotNull SimpleColoredComponent component) { synchronized (mySections) { for (TextSection section : mySections) { final TextAttributes attributes = section.getTextAttributes(); @@ -71,6 +71,7 @@ public class CompositeAppearance implements ModifiableCellAppearanceEx, Modifiab } } + @NotNull public String getText() { synchronized (mySections) { StringBuilder buffer = new StringBuilder(); diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/ModifiableCellAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/ModifiableCellAppearance.java deleted file mode 100644 index 353297d23c7c..000000000000 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/ModifiableCellAppearance.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.roots.ui.util; - -import javax.swing.*; - -/** - * @author dyoma - * @deprecated please use {@linkplain com.intellij.openapi.roots.ui.ModifiableCellAppearanceEx} (to remove in IDEA 12). - */ -public interface ModifiableCellAppearance extends CellAppearance { - Icon getIcon(); - void setIcon(Icon icon); -} diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java index e598f3f62fde..bba26727092d 100644 --- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java +++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/SimpleTextCellAppearance.java @@ -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. @@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; // todo: move to lang-impl ? -public class SimpleTextCellAppearance implements ModifiableCellAppearanceEx, ModifiableCellAppearance { +public class SimpleTextCellAppearance implements ModifiableCellAppearanceEx { private Icon myIcon; private final SimpleTextAttributes myTextAttributes; private final String myText; @@ -38,11 +38,6 @@ public class SimpleTextCellAppearance implements ModifiableCellAppearanceEx, Mod return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.ERROR_ATTRIBUTES); } - /** @deprecated use {@linkplain #regular(String, javax.swing.Icon)} (to remove in IDEA 12) */ - public static CellAppearance normal(@NotNull final String text, @Nullable final Icon icon) { - return regular(text, icon); - } - public static SimpleTextCellAppearance synthetic(@NotNull final String text, @Nullable final Icon icon) { return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); } @@ -78,12 +73,6 @@ public class SimpleTextCellAppearance implements ModifiableCellAppearanceEx, Mod return myTextAttributes; } - @Override - @Nullable - public Icon getIcon() { - return myIcon; - } - @Override public void setIcon(@Nullable final Icon icon) { myIcon = icon; diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java index 5b401dbbe92a..4afd7754bdc4 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java @@ -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. @@ -171,14 +171,6 @@ public class ComboBoxTableRenderer extends JLabel implements TableCellRendere setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); } - /** @deprecated use {@linkplain #customizeComponent(Object, javax.swing.JTable, boolean)} (to remove in IDEA 12) */ - protected void customizeComponent(T value, boolean isSelected) { - setOpaque(true); - setText(value == null ? "" : getTextFor(value)); - setBackground(isSelected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground()); - setForeground(isSelected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground()); - } - public Object getCellEditorValue() { return myValue; } diff --git a/platform/platform-api/src/com/intellij/ui/GuiUtils.java b/platform/platform-api/src/com/intellij/ui/GuiUtils.java index 68c970d04780..a3702a05b7cb 100644 --- a/platform/platform-api/src/com/intellij/ui/GuiUtils.java +++ b/platform/platform-api/src/com/intellij/ui/GuiUtils.java @@ -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. @@ -82,7 +82,7 @@ public class GuiUtils { return constructFieldWithBrowseButton(aTextField, new ActionListener() { public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.getDirectoryChooserDescriptor(aSearchedObjectName); - VirtualFile file = FileChooser.chooseFile(aTextField, descriptor); + VirtualFile file = FileChooser.chooseFile(descriptor, aTextField, null, null); if (file != null) { aTextField.setText(FileUtil.toSystemDependentName(file.getPath())); aTextField.postActionEvent(); @@ -96,7 +96,7 @@ public class GuiUtils { return constructFieldWithBrowseButton(aFieldWithHistory, new ActionListener() { public void actionPerformed(ActionEvent e) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.getFileChooserDescriptor(aSearchedObjectName); - VirtualFile file = FileChooser.chooseFile(aFieldWithHistory, descriptor); + VirtualFile file = FileChooser.chooseFile(descriptor, aFieldWithHistory, null, null); if (file != null) { try { aFieldWithHistory.setText(VfsUtil.virtualToIoFile(file).toURL().toString()); diff --git a/platform/platform-api/src/com/intellij/ui/HtmlListCellRenderer.java b/platform/platform-api/src/com/intellij/ui/HtmlListCellRenderer.java index f383b18eb0b6..7669dcec59ce 100644 --- a/platform/platform-api/src/com/intellij/ui/HtmlListCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/HtmlListCellRenderer.java @@ -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. @@ -16,8 +16,6 @@ package com.intellij.ui; import com.intellij.ide.ui.ListCellRendererWrapper; -import com.intellij.openapi.roots.ui.CellAppearanceEx; -import com.intellij.openapi.roots.ui.util.ModifiableCellAppearance; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.StringBuilderSpinAllocator; import org.jetbrains.annotations.NotNull; @@ -125,9 +123,4 @@ public abstract class HtmlListCellRenderer extends ListCellRendererWrapper } builder.append('"'); } - - /** @deprecated use {@linkplain com.intellij.openapi.roots.ui.CellAppearanceEx#customize(HtmlListCellRenderer)} (to remove in IDEA 12) */ - public void render(@NotNull final ModifiableCellAppearance appearance) { - ((CellAppearanceEx)appearance).customize(this); - } } diff --git a/platform/platform-api/src/com/intellij/ui/InsertPathAction.java b/platform/platform-api/src/com/intellij/ui/InsertPathAction.java index f1c52776b9d6..848c574d8be3 100644 --- a/platform/platform-api/src/com/intellij/ui/InsertPathAction.java +++ b/platform/platform-api/src/com/intellij/ui/InsertPathAction.java @@ -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. @@ -63,7 +63,7 @@ public class InsertPathAction extends AnAction { } //TODO use from openapi //FeatureUsageTracker.getInstance().triggerFeatureUsed("ui.commandLine.insertPath"); - VirtualFile[] files = FileChooser.chooseFiles(myTextField, myDescriptor, virtualFile); + VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myTextField, getEventProject(e), virtualFile); if (files.length != 0) { myTextField.replaceSelection(files[0].getPresentableUrl()); } diff --git a/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java b/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java index 6f99bce00008..834e4d241bc2 100644 --- a/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java +++ b/platform/platform-api/src/com/intellij/util/concurrency/QueueProcessor.java @@ -145,7 +145,9 @@ public class QueueProcessor { } public void add(T t, ModalityState state) { - myModalityState.put(new MyOverrideEquals(t), state); + synchronized (myQueue) { + myModalityState.put(new MyOverrideEquals(t), state); + } doAdd(t, false); } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ChooseComponentsToExportDialog.java b/platform/platform-impl/src/com/intellij/ide/actions/ChooseComponentsToExportDialog.java index 25003aee1dfc..6f12cf6a508b 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ChooseComponentsToExportDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ChooseComponentsToExportDialog.java @@ -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. @@ -159,7 +159,7 @@ public class ChooseComponentsToExportDialog extends DialogWrapper { else { initialDir = null; } - final VirtualFile file = FileChooser.chooseFile(parent, chooserDescriptor, initialDir); + final VirtualFile file = FileChooser.chooseFile(chooserDescriptor, parent, null, initialDir); if (file == null) { return null; } diff --git a/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java b/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java index 7ad3430e1848..8350d8ed9343 100644 --- a/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java +++ b/platform/platform-impl/src/com/intellij/ide/diff/VirtualFileDiffElement.java @@ -22,8 +22,8 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.diff.DiffRequest; import com.intellij.openapi.editor.Document; +import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.fileEditor.*; import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager; import com.intellij.openapi.fileTypes.FileTypeManager; @@ -125,8 +125,7 @@ public class VirtualFileDiffElement extends DiffElement { @Override public DiffElement call() throws Exception { final FileChooserDescriptor descriptor = getChooserDescriptor(); - final VirtualFile[] result = FileChooserFactory.getInstance() - .createFileChooser(descriptor, project).choose(getValue(), project); + final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, getValue()); return result.length == 1 ? createElement(result[0]) : null; } }; diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java index 446cecb77a0c..c98519bdc56a 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java @@ -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. @@ -81,7 +81,7 @@ public class InstalledPluginsManagerMain extends PluginManagerMain { }; descriptor.setTitle("Choose Plugin File"); descriptor.setDescription("JAR and ZIP archives are accepted"); - final VirtualFile virtualFile = FileChooser.chooseFile(myActionsPanel, descriptor); + final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, myActionsPanel, null, null); if (virtualFile != null) { final File file = VfsUtil.virtualToIoFile(virtualFile); try { diff --git a/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java b/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java index ae9c9a6841be..091d5db332e6 100644 --- a/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java +++ b/platform/platform-impl/src/com/intellij/internal/encodings/EncodingViewer.java @@ -46,7 +46,7 @@ public class EncodingViewer extends DialogWrapper { initEncodings(); myLoadFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - VirtualFile file = FileChooser.chooseFile(myPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); + VirtualFile file = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), myPanel, null, null); if (file != null) { loadFrom(file); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareDirectoriesAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareDirectoriesAction.java index b9ccf6b2aa91..7f3ed2b21ef3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareDirectoriesAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareDirectoriesAction.java @@ -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. @@ -22,8 +22,8 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.diff.DirDiffManager; +import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; @@ -42,11 +42,11 @@ public class CompareDirectoriesAction extends AnAction { if (files.length == 2 && files[0].isDirectory() && files[1].isDirectory()) { src = new VirtualFileDiffElement(files[0]); trg = new VirtualFileDiffElement(files[1]); - } else if (files.length == 1 && files[0].isDirectory()) { + } + else if (files.length == 1 && files[0].isDirectory()) { src = new VirtualFileDiffElement(files[0]); final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false); - final VirtualFile[] result = FileChooserFactory.getInstance() - .createFileChooser(descriptor, project).choose(project.getBaseDir(), project); + final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, project.getBaseDir()); if (result.length == 1 && result[0] != null && result[0].isDirectory()) { trg = new VirtualFileDiffElement(result[0]); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareJarsAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareJarsAction.java index d94ebcef085b..77d3b7bf5249 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareJarsAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/CompareJarsAction.java @@ -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. @@ -24,8 +24,8 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.diff.DirDiffManager; +import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; @@ -33,7 +33,6 @@ import com.intellij.openapi.vfs.VirtualFile; * @author Konstantin Bulenkov */ public class CompareJarsAction extends AnAction { - // @Override public void actionPerformed(AnActionEvent e) { final Project project = getEventProject(e); @@ -45,7 +44,8 @@ public class CompareJarsAction extends AnAction { if (files.length == 2 && isArchive(files[0]) && isArchive(files[1])) { src = new JarFileDiffElement(files[0]); trg = new JarFileDiffElement(files[1]); - } else if (files.length == 1 && isArchive(files[0])) { + } + else if (files.length == 1 && isArchive(files[0])) { src = new JarFileDiffElement(files[0]); final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, false) { @Override @@ -54,8 +54,7 @@ public class CompareJarsAction extends AnAction { || (!file.isDirectory() && isArchive(file)); } }; - final VirtualFile[] result = FileChooserFactory.getInstance() - .createFileChooser(descriptor, project).choose(project.getBaseDir(), project); + final VirtualFile[] result = FileChooser.chooseFiles(descriptor, project, project.getBaseDir()); if (result.length == 1 && result[0] != null && isArchive(result[0])) { trg = new JarFileDiffElement(result[0]); } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java index a697360556e0..0a710f8de671 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java @@ -349,11 +349,6 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD myFileSystemTree.registerMouseListener(group); } - /** @deprecated internal method (to remove in IDEA 12) */ - protected VirtualFile[] getSelectedFiles() { - return getSelectedFilesInt(); - } - private VirtualFile[] getSelectedFilesInt() { final List selectedFiles = Arrays.asList(myFileSystemTree.getSelectedFiles()); return VfsUtil.toVirtualFileArray(FileChooserUtil.getChosenFiles(myChooserDescriptor, selectedFiles)); diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java index 27de84f33e57..0de270d5b88f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileSystemTreeImpl.java @@ -27,7 +27,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.impl.FileChooserUtil; import com.intellij.openapi.fileChooser.FileElement; import com.intellij.openapi.fileChooser.FileSystemTree; import com.intellij.openapi.fileChooser.impl.FileComparator; @@ -361,14 +360,6 @@ public class FileSystemTreeImpl implements FileSystemTree { return VfsUtil.toVirtualFileArray(files); } - /** @deprecated use {@linkplain FileChooserUtil#getChosenFiles(com.intellij.openapi.fileChooser.FileChooserDescriptor, java.util.List)} (to remove in IDEA 12) */ - @SuppressWarnings("UnusedDeclaration") - @NotNull - public VirtualFile[] getChosenFiles() { - final List selectedFiles = Arrays.asList(getSelectedFiles()); - return VfsUtil.toVirtualFileArray(FileChooserUtil.getChosenFiles(myTreeStructure.getChooserDescriptor(), selectedFiles)); - } - private List collectSelectedElements(final Function converter) { final TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) return Collections.emptyList(); diff --git a/platform/platform-impl/src/com/intellij/platform/DirectoryProjectGenerator.java b/platform/platform-impl/src/com/intellij/platform/DirectoryProjectGenerator.java index 368fefd55f73..f467263db1fc 100644 --- a/platform/platform-impl/src/com/intellij/platform/DirectoryProjectGenerator.java +++ b/platform/platform-impl/src/com/intellij/platform/DirectoryProjectGenerator.java @@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @author yole @@ -33,6 +34,7 @@ public interface DirectoryProjectGenerator { @Nls String getName(); + @Nullable T showGenerationSettings(final VirtualFile baseDir) throws ProcessCanceledException; void generateProject(final Project project, final VirtualFile baseDir, final T settings, Module module); diff --git a/platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java b/platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java index 22ed5780f52f..d6977c53ef82 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java +++ b/platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -50,8 +50,7 @@ public class LocalPathCellEditor extends AbstractTableCellEditor { final FileChooserDescriptor d = getFileChooserDescriptor(); String initial = (String)getCellEditorValue(); VirtualFile initialFile = StringUtil.isNotEmpty(initial) ? LocalFileSystem.getInstance().findFileByPath(initial) : null; - VirtualFile file = - myProject != null ? FileChooser.chooseFile(myProject, d, initialFile) : FileChooser.chooseFile(table, d, initialFile); + VirtualFile file = FileChooser.chooseFile(d, table, myProject, initialFile); if (file != null) { String path = file.getPresentableUrl(); if (SystemInfo.isWindows && path.length() == 2 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') { diff --git a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java index 062d9d4e9c75..f005b9ec19f6 100644 --- a/platform/util/src/com/intellij/openapi/util/io/FileUtil.java +++ b/platform/util/src/com/intellij/openapi/util/io/FileUtil.java @@ -901,18 +901,6 @@ public class FileUtil extends FileUtilRt { return file.canExecute(); } - /** @deprecated use {@link FileSystemUtil#isSymLink(File)} (to remove in IDEA 12) */ - @SuppressWarnings("UnusedDeclaration") - public static boolean isSymbolicLink(File file) { - return FileSystemUtil.isSymLink(file); - } - - /** @deprecated use {@link FileSystemUtil#isSymLink(File)} (to remove in IDEA 12) */ - @SuppressWarnings("UnusedDeclaration") - public static boolean isSymbolicLink(File parent, String name) { - return FileSystemUtil.isSymLink(new File(parent, name)); - } - public static void setReadOnlyAttribute(@NotNull String path, boolean readOnlyFlag) throws IOException { final boolean writableFlag = !readOnlyFlag; final File file = new File(path); diff --git a/platform/util/src/com/intellij/util/ui/MappingListCellRenderer.java b/platform/util/src/com/intellij/util/ui/MappingListCellRenderer.java deleted file mode 100644 index bffd1ce40bc5..000000000000 --- a/platform/util/src/com/intellij/util/ui/MappingListCellRenderer.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2000-2011 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.util.ui; - -import com.intellij.openapi.util.Pair; - -import javax.swing.*; -import java.awt.*; -import java.util.HashMap; -import java.util.Map; - -/** - * @deprecated use {@link com.intellij.ide.ui.MappingListCellRenderer} (to remove in IDEA 12). - */ -@SuppressWarnings("UnusedDeclaration") -public class MappingListCellRenderer extends DefaultListCellRenderer { - private final Map myValueMap; - - public MappingListCellRenderer(final Map valueMap) { - myValueMap = valueMap; - } - - public MappingListCellRenderer(final Pair... valuePairs) { - myValueMap = new HashMap(); - for (Pair valuePair : valuePairs) { - myValueMap.put(valuePair.getFirst(), valuePair.getSecond()); - } - } - - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - String newValue = myValueMap.get(value); - if (newValue != null) { - setText(newValue); - } - return this; - } -} diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index b65181ae178d..2736edbb4e0e 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -2326,22 +2326,6 @@ public class UIUtil { myLineSpacing = 1.0f; } - /** @deprecated use {@linkplain #withLineSpacing(float)} (to remove in IDEA 12) */ - @SuppressWarnings("UnusedDeclaration") - public TextPainter(final float lineSpacing) { - myDrawShadow = isUnderAquaLookAndFeel(); - myShadowColor = Gray._220; - myLineSpacing = lineSpacing; - } - - /** @deprecated use {@linkplain #withShadow(boolean, java.awt.Color)} and {@linkplain #withLineSpacing(float)} (to remove in IDEA 12) */ - @SuppressWarnings("UnusedDeclaration") - public TextPainter(final boolean drawShadow, final Color shadowColor, final float lineSpacing) { - myDrawShadow = drawShadow; - myShadowColor = shadowColor; - myLineSpacing = lineSpacing; - } - public TextPainter withShadow(final boolean drawShadow) { myDrawShadow = drawShadow; return this; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java index c557a030ab57..0278d7fa5958 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java @@ -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. @@ -577,7 +577,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper { private class NewBaseSelector implements Runnable { public void run() { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); - VirtualFile selectedFile = FileChooser.chooseFile(myProject, descriptor); + VirtualFile selectedFile = FileChooser.chooseFile(descriptor, myProject, null); if (selectedFile == null) { return; } diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java index 7d36e83559bc..8ac71a46989d 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/InjectionsSettingsUI.java @@ -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. @@ -795,7 +795,7 @@ public class InjectionsSettingsUI implements SearchableConfigurable.Parent, NonD final SplitterProportionsData splitterData = new SplitterProportionsDataImpl(); splitterData.externalizeFromDimensionService("IntelliLang.ImportSettingsKey.SplitterProportions"); - final VirtualFile file = FileChooser.chooseFile(myProject, descriptor); + final VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file == null) return; try { final Configuration cfg = Configuration.load(file.getInputStream()); diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java index 81044a975ac5..ae9441762fd5 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java @@ -93,6 +93,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel { myProfileAction = new ProfileAction(this, new Runnable() { @Override public void run() { + myPSIChangeListener.setInitialize(); myActionPanel.update(); if (myRootComponent == null) { myPSIChangeListener.activate(); @@ -403,7 +404,7 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel { if (StringUtil.isEmpty(exception.getPresentableMessage())) { Throwable[] causes = exception.getCauses(); if (causes.length == 0) { - info.myThrowable = new RenderingException(AndroidBundle.message("android.layout.preview.default.error.message")); + info.myThrowable = new Exception(AndroidBundle.message("android.layout.preview.default.error.message"), exception); } else if (causes.length == 1) { info.myThrowable = causes[0]; diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/ExternalPSIChangeListener.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/ExternalPSIChangeListener.java index af87bcd6aef1..65bf00b1fd07 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/ExternalPSIChangeListener.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/ExternalPSIChangeListener.java @@ -26,28 +26,31 @@ import com.intellij.util.Alarm; import com.intellij.util.containers.ComparatorUtil; import org.jetbrains.annotations.NotNull; -import javax.swing.*; - /** * @author Alexander Lobas */ public class ExternalPSIChangeListener extends PsiTreeChangeAdapter { private final Alarm myAlarm = new Alarm(); - private final JComponent myComponent; + private final AndroidDesignerEditorPanel myDesigner; private final PsiFile myFile; private final int myDelayMillis; private final Runnable myRunnable; private volatile boolean myRunState; + private volatile boolean myInitialize; private String myContent; - public ExternalPSIChangeListener(JComponent component, PsiFile file, int delayMillis, Runnable runnable) { - myComponent = component; + public ExternalPSIChangeListener(AndroidDesignerEditorPanel designer, PsiFile file, int delayMillis, Runnable runnable) { + myDesigner = designer; myFile = file; myDelayMillis = delayMillis; myRunnable = runnable; myContent = getContent(); } + public void setInitialize() { + myInitialize = true; + } + public void start() { if (!myRunState) { myRunState = true; @@ -66,7 +69,7 @@ public class ExternalPSIChangeListener extends PsiTreeChangeAdapter { public void activate() { if (!myRunState) { start(); - if (!ComparatorUtil.equalsNullable(myContent, getContent())) { + if (!ComparatorUtil.equalsNullable(myContent, getContent()) || myDesigner.getRootComponent() == null) { addRequest(); } myContent = null; @@ -104,11 +107,11 @@ public class ExternalPSIChangeListener extends PsiTreeChangeAdapter { myAlarm.addRequest(new Runnable() { @Override public void run() { - if (myRunState) { + if (myRunState && myInitialize) { runnable.run(); } } - }, myDelayMillis, ModalityState.stateForComponent(myComponent)); + }, myDelayMillis, ModalityState.stateForComponent(myDesigner)); } public void clear() { diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutOperation.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutOperation.java new file mode 100644 index 000000000000..f0d700b7c228 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/TableLayoutOperation.java @@ -0,0 +1,119 @@ +/* + * 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.android.designer.designSurface.layout; + +import com.intellij.android.designer.designSurface.AbstractEditOperation; +import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.android.designer.model.table.RadTableLayoutComponent; +import com.intellij.designer.designSurface.FeedbackLayer; +import com.intellij.designer.designSurface.OperationContext; +import com.intellij.designer.model.RadComponent; + +import javax.swing.*; +import java.awt.*; +import java.util.List; + +/** + * @author Alexander Lobas + */ +public class TableLayoutOperation extends AbstractEditOperation { + private GridFeedback myFeedback; + + public TableLayoutOperation(RadComponent container, OperationContext context) { + super(container, context); + } + + private void createFeedback() { + if (myFeedback == null) { + FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); + myFeedback = new GridFeedback(); + myFeedback.setBounds(myContainer.getBounds(layer)); + layer.add(myFeedback); + layer.repaint(); + } + } + + @Override + public void showFeedback() { + createFeedback(); + } + + @Override + public void eraseFeedback() { + if (myFeedback != null) { + FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); + layer.remove(myFeedback); + layer.repaint(); + myFeedback = null; + } + } + + ////////////////////////////////////////////////////////////////////////////////////////// + // + // Feedback + // + ////////////////////////////////////////////////////////////////////////////////////////// + + public static final Color COLOR = new Color(80, 110, 160); + + private class GridFeedback extends JComponent { + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.setColor(COLOR); + + Rectangle bounds = getBounds(); + bounds.x = bounds.y = 0; + + int[] columnWidths = ((RadTableLayoutComponent)myContainer).getColumnWidths(); + + if (columnWidths != null && columnWidths.length > 0) { + int x = bounds.x; + + for (int i = 0; i < columnWidths.length; i++) { + int width = columnWidths[i]; + + if (width > 0) { + x += width; + + if (i != columnWidths.length - 1 || x < bounds.getMinX()) { + g.drawLine(x, bounds.y, x, bounds.y + bounds.height); + } + } + else { + g.drawLine(x + 2, bounds.y, x + 2, bounds.y + bounds.height); + } + } + + bounds.width = Math.max(bounds.width, x - bounds.x); + } + + List children = myContainer.getChildren(); + RadComponent last = children.isEmpty() ? null : children.get(children.size() - 1); + + for (RadComponent child : children) { + Rectangle childBounds = child.getBounds(this); + int y = childBounds.y + childBounds.height + ((RadViewComponent)child).getMargins().height; + + if (child != last || y < bounds.getMaxY()) { + g.drawLine(bounds.x, y, bounds.x + bounds.width, y); + } + } + + g.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); + } + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java index 92952bf54b02..502cfb27c903 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableColumn.java @@ -57,4 +57,14 @@ public class RadCaptionTableColumn extends RadVisualComponent { public void addStaticDecorators(List decorators, List selection) { decorators.add(myDecorator); } + + @Override + public boolean canDelete() { + return false; // TODO: Auto-generated method stub + } + + @Override + public void delete() throws Exception { + // TODO: Auto-generated method stub + } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java index f2e7416b43b9..d0d9f199eadd 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadCaptionTableRow.java @@ -58,4 +58,9 @@ public class RadCaptionTableRow extends RadVisualComponent { public void addStaticDecorators(List decorators, List selection) { decorators.add(myDecorator); } + + @Override + public void delete() throws Exception { + myComponent.delete(); + } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java index 0275805744c3..50343c814537 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayout.java @@ -19,6 +19,7 @@ import com.intellij.android.designer.designSurface.*; import com.intellij.android.designer.designSurface.AbstractEditOperation; import com.intellij.android.designer.designSurface.layout.ResizeOperation; import com.intellij.android.designer.designSurface.layout.TableLayoutDecorator; +import com.intellij.android.designer.designSurface.layout.TableLayoutOperation; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.model.RadViewLayout; import com.intellij.android.designer.model.RadViewLayoutWithData; @@ -60,8 +61,7 @@ public class RadTableLayout extends RadViewLayoutWithData implements ILayoutDeco } return null; } - // XXX - return null; + return new TableLayoutOperation(myContainer, context); } if (context.is(ResizeOperation.TYPE)) { return new ResizeOperation(context); @@ -138,7 +138,23 @@ public class RadTableLayout extends RadViewLayoutWithData implements ILayoutDeco @Override public ICaption getCaption(RadComponent component) { - return myContainer == component && myContainer.getParent().getLayout() instanceof ICaptionDecorator ? null : this; + if (myContainer == component) { + // skip for caption parent, example: ...( Caption( TableLayout ) ) + RadComponent parent = myContainer.getParent(); + if (parent.getLayout() instanceof ICaptionDecorator) { + return null; + } + + // skip for caption parent.parent, example: ...( TableLayout( TableRowLayout( TableLayout ) ) ) + parent = parent.getParent(); + if (parent != null && parent.getLayout() instanceof ICaptionDecorator) { + return null; + } + } + if (myContainer.getChildren().isEmpty()) { + return null; + } + return this; } @Override @@ -149,19 +165,11 @@ public class RadTableLayout extends RadViewLayoutWithData implements ILayoutDeco List components = new ArrayList(); if (horizontal) { - if (children.isEmpty()) { - components.add(new RadCaptionTableColumn(container, 0, container.getBounds().width)); + int columnOffset = 0; + for (int columnWidth : container.getColumnWidths()) { + components.add(new RadCaptionTableColumn(container, columnOffset, Math.max(columnWidth, 2))); + columnOffset += columnWidth; } - else { - int columnOffset = 0; - for (int columnWidth : container.getColumnWidths()) { - components.add(new RadCaptionTableColumn(container, columnOffset, Math.max(columnWidth, 2))); - columnOffset += columnWidth; - } - } - } - else if (children.isEmpty()) { - components.add(new RadCaptionTableRow(container)); } else { for (RadComponent component : children) { @@ -179,6 +187,7 @@ public class RadTableLayout extends RadViewLayoutWithData implements ILayoutDeco @NotNull public RadLayout getCaptionLayout(final EditableArea mainArea, boolean horizontal) { if (horizontal) { + // TODO return myCaptionColumnLayout; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java index 17a2006ac959..e478251c11cc 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/table/RadTableLayoutComponent.java @@ -17,6 +17,7 @@ package com.intellij.android.designer.model.table; import com.android.ide.common.rendering.api.ViewInfo; import com.intellij.android.designer.model.RadViewContainer; +import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; @@ -45,6 +46,9 @@ public class RadTableLayoutComponent extends RadViewContainer { } catch (Throwable e) { } + if (myColumnWidths == null) { + myColumnWidths = ArrayUtil.EMPTY_INT_ARRAY; + } } return myColumnWidths; } diff --git a/plugins/android/resources/icons/androidToolWindow.png b/plugins/android/resources/icons/androidToolWindow.png new file mode 100644 index 000000000000..a0575c21d523 Binary files /dev/null and b/plugins/android/resources/icons/androidToolWindow.png differ diff --git a/plugins/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java b/plugins/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java index b1934e9d23b8..526d43d4d8a2 100644 --- a/plugins/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java +++ b/plugins/android/src/org/jetbrains/android/exportSignedPackage/ApkStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -33,11 +33,13 @@ import com.intellij.openapi.compiler.CompileScope; import com.intellij.openapi.compiler.CompileStatusNotification; import com.intellij.openapi.compiler.CompilerManager; import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.module.Module; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.Task; +import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.TextFieldWithBrowseButton; @@ -116,7 +118,8 @@ class ApkStep extends ExportSignedPackageWizardStep { return getContentRootPath(module); } }); - + + final Project project = wizard.getProject(); myProguardConfigFilePathField.getButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -129,8 +132,8 @@ class ApkStep extends ExportSignedPackageWizardStep { if (defaultFile == null && facet != null) { defaultFile = AndroidRootUtil.getMainContentRoot(facet); } - final VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), - defaultFile); + final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); + final VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, project, defaultFile); if (file != null) { myProguardConfigFilePathField.setText(FileUtil.toSystemDependentName(file.getPath())); } diff --git a/plugins/android/src/org/jetbrains/android/exportSignedPackage/KeystoreStep.java b/plugins/android/src/org/jetbrains/android/exportSignedPackage/KeystoreStep.java index be70a41ff723..1cd022ce4fad 100644 --- a/plugins/android/src/org/jetbrains/android/exportSignedPackage/KeystoreStep.java +++ b/plugins/android/src/org/jetbrains/android/exportSignedPackage/KeystoreStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -19,6 +19,7 @@ package org.jetbrains.android.exportSignedPackage; import com.intellij.ide.util.PropertiesComponent; import com.intellij.ide.wizard.CommitStepException; import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.util.io.FileUtil; @@ -204,7 +205,8 @@ class KeystoreStep extends ExportSignedPackageWizardStep { path = defaultLocation != null ? defaultLocation : ""; } VirtualFile f = LocalFileSystem.getInstance().findFileByPath(path); - VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), f); + FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); + VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, myWizard.getProject(), f); if (file != null) { myKeystoreLocationField.setText(FileUtil.toSystemDependentName(file.getPath())); } diff --git a/plugins/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java b/plugins/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java index 984c19c932f6..c9b6dfa70b98 100644 --- a/plugins/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java +++ b/plugins/android/src/org/jetbrains/android/facet/AndroidFacetEditorTab.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -151,8 +151,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab { if (defaultFile == null) { defaultFile = AndroidRootUtil.getMainContentRoot(facet); } - final VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), - defaultFile); + final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); + final VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, project, defaultFile); if (file != null) { myProguardConfigFileTextField.setText(FileUtil.toSystemDependentName(file.getPath())); } @@ -686,7 +686,8 @@ public class AndroidFacetEditorTab extends FacetEditorTab { } } } - VirtualFile file = FileChooser.chooseFile(myContentPanel, FileChooserDescriptorFactory.createSingleFolderDescriptor(), initialFile); + final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); + VirtualFile file = FileChooser.chooseFile(descriptor, myContentPanel, myContext.getProject(), initialFile); if (file != null) { myTextField.setText(FileUtil.toSystemDependentName(file.getPath())); } @@ -741,21 +742,21 @@ public class AndroidFacetEditorTab extends FacetEditorTab { initialFile = LocalFileSystem.getInstance().findFileByPath(p); } } - return FileChooser - .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; - } - - if (!file.isDirectory() && !chooseFile) { - return false; - } - - return filter == null || filter.value(file); + final FileChooserDescriptor descriptor = new FileChooserDescriptor(chooseFile, !chooseFile, false, false, false, chooseMultiple) { + @Override + public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) { + if (!super.isFileVisible(file, showHiddenFiles)) { + return false; } - }, initialFile); + + if (!file.isDirectory() && !chooseFile) { + return false; + } + + return filter == null || filter.value(file); + } + }; + return FileChooser.chooseFiles(descriptor, myContentPanel, myContext.getProject(), initialFile); } private static class MyManifestFilter implements Condition { diff --git a/plugins/android/src/org/jetbrains/android/logcat/AndroidLogcatToolWindowFactory.java b/plugins/android/src/org/jetbrains/android/logcat/AndroidLogcatToolWindowFactory.java index 389f0f05b1a6..b2b061d4e2c2 100644 --- a/plugins/android/src/org/jetbrains/android/logcat/AndroidLogcatToolWindowFactory.java +++ b/plugins/android/src/org/jetbrains/android/logcat/AndroidLogcatToolWindowFactory.java @@ -57,7 +57,7 @@ public class AndroidLogcatToolWindowFactory implements ToolWindowFactory { public static final String TOOL_WINDOW_ID = AndroidBundle.message("android.logcat.title"); public void createToolWindowContent(final Project project, final ToolWindow toolWindow) { - toolWindow.setIcon(AndroidUtils.ANDROID_ICON); + toolWindow.setIcon(AndroidUtils.ANDROID_TOOLWINDOW_ICON); toolWindow.setAvailable(true, null); toolWindow.setToHideOnEmptyContent(true); toolWindow.setTitle(TOOL_WINDOW_ID); diff --git a/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java b/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java index cf31d08bcddd..2dc112b8b14d 100644 --- a/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java +++ b/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java @@ -97,6 +97,7 @@ public class AndroidUtils { private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.util.AndroidUtils"); // Icons + public static final Icon ANDROID_TOOLWINDOW_ICON = IconLoader.getIcon("/icons/androidToolWindow.png"); public static final Icon ANDROID_ICON = IconLoader.getIcon("/icons/android.png"); public static final Icon DDMS_ICON = IconLoader.getIcon("/icons/ddms.png"); public static final Icon RESTART_LOGCAT_ICON = IconLoader.getIcon("/icons/restartLogcat.png"); diff --git a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntBuildFileNodeDescriptor.java b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntBuildFileNodeDescriptor.java index 4e44046f303b..5e2aaf36eb60 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntBuildFileNodeDescriptor.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntBuildFileNodeDescriptor.java @@ -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. @@ -62,7 +62,7 @@ final class AntBuildFileNodeDescriptor extends AntNodeDescriptor { return !Comparing.equal(myAppearance, oldAppearence); } - public void customize(SimpleColoredComponent component) { + public void customize(@NotNull SimpleColoredComponent component) { if (myAppearance != null) { myAppearance.customize(component); } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java index afcc85cee970..c9032f081905 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntExplorer.java @@ -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. @@ -34,7 +34,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileEditor.OpenFileDescriptor; -import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.keymap.Keymap; import com.intellij.openapi.keymap.KeymapManagerListener; @@ -206,7 +205,7 @@ public class AntExplorer extends SimpleToolWindowPanel implements DataProvider, final FileChooserDescriptor descriptor = createXmlDescriptor(); descriptor.setTitle(AntBundle.message("select.ant.build.file.dialog.title")); descriptor.setDescription(AntBundle.message("select.ant.build.file.dialog.description")); - final VirtualFile[] files = FileChooser.chooseFiles(myProject, descriptor); + final VirtualFile[] files = FileChooser.chooseFiles(descriptor, myProject, null); if (files.length == 0) { return; } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntNodeDescriptor.java b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntNodeDescriptor.java index d820b1478a27..daf89da31b24 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntNodeDescriptor.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntNodeDescriptor.java @@ -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. @@ -30,7 +30,7 @@ abstract class AntNodeDescriptor extends NodeDescriptor implements CellAppearanc public abstract boolean isAutoExpand(); - public void customize(SimpleColoredComponent component) { + public void customize(@NotNull SimpleColoredComponent component) { component.append(toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES); } @@ -39,6 +39,7 @@ abstract class AntNodeDescriptor extends NodeDescriptor implements CellAppearanc renderer.append(toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES); } + @NotNull public String getText() { return toString(); } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntTargetNodeDescriptor.java b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntTargetNodeDescriptor.java index 9a2487103900..b5fe79ba9959 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntTargetNodeDescriptor.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/explorer/AntTargetNodeDescriptor.java @@ -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. @@ -137,7 +137,7 @@ final class AntTargetNodeDescriptor extends AntNodeDescriptor { return false; } - public void customize(SimpleColoredComponent component) { + public void customize(@NotNull SimpleColoredComponent component) { getHighlightedText().customize(component); component.setIcon(getOpenIcon()); String toolTipText = getTarget().getNotEmptyDescription(); diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/AllJarsUnderDirEntry.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/AllJarsUnderDirEntry.java index 86712d278ee2..6ab06e4b18fb 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/AllJarsUnderDirEntry.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/AllJarsUnderDirEntry.java @@ -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. @@ -15,12 +15,10 @@ */ package com.intellij.lang.ant.config.impl; -import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.roots.ui.CellAppearanceEx; import com.intellij.openapi.roots.ui.FileAppearanceService; import com.intellij.openapi.roots.ui.ModifiableCellAppearanceEx; -import com.intellij.openapi.util.Factory; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.WriteExternalException; import com.intellij.openapi.vfs.LocalFileSystem; @@ -38,14 +36,17 @@ import java.util.List; public class AllJarsUnderDirEntry implements AntClasspathEntry { private static final Icon ALL_JARS_IN_DIR_ICON = IconLoader.getIcon("/ant/allJarsInDir.png"); - private final File myDir; - @NonNls static final String DIR = "dir"; + @NonNls private static final String JAR_SUFFIX = ".jar"; + private static final Function CREATE_FROM_VIRTUAL_FILE = new Function() { public AntClasspathEntry fun(VirtualFile file) { return fromVirtualFile(file); } }; - @NonNls public static final String JAR_SUFFIX = ".jar"; + + @NonNls static final String DIR = "dir"; + + private final File myDir; public AllJarsUnderDirEntry(final File dir) { myDir = dir; @@ -85,17 +86,10 @@ public class AllJarsUnderDirEntry implements AntClasspathEntry { return new AllJarsUnderDirEntry(file.getPath()); } - public static class AddEntriesFactory implements Factory> { - private final JComponent myParentComponent; - - public AddEntriesFactory(final JComponent component) { - myParentComponent = component; - } - - public List create() { - VirtualFile[] files = FileChooser.chooseFiles(myParentComponent, FileChooserDescriptorFactory.createMultipleFoldersDescriptor()); - if (files.length == 0) return null; - return ContainerUtil.map(files, CREATE_FROM_VIRTUAL_FILE); + @SuppressWarnings("ClassNameSameAsAncestorName") + public static class AddEntriesFactory extends AntClasspathEntry.AddEntriesFactory { + public AddEntriesFactory(final JComponent parentComponent) { + super(parentComponent, FileChooserDescriptorFactory.createMultipleFoldersDescriptor(), CREATE_FROM_VIRTUAL_FILE); } } } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntClasspathEntry.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntClasspathEntry.java index 836c329d9039..a109fa1a4d8e 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntClasspathEntry.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntClasspathEntry.java @@ -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. @@ -15,13 +15,20 @@ */ package com.intellij.lang.ant.config.impl; +import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.roots.ui.CellAppearanceEx; import com.intellij.openapi.util.InvalidDataException; +import com.intellij.openapi.util.NullableFactory; import com.intellij.openapi.util.WriteExternalException; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.Function; import com.intellij.util.PathUtil; import com.intellij.util.config.Externalizer; +import com.intellij.util.containers.ContainerUtil; import org.jdom.Element; +import javax.swing.*; import java.io.File; import java.util.List; @@ -49,4 +56,23 @@ public interface AntClasspathEntry { void addFilesTo(List files); CellAppearanceEx getAppearance(); + + abstract class AddEntriesFactory implements NullableFactory> { + private final JComponent myParentComponent; + private final FileChooserDescriptor myDescriptor; + private final Function myMapper; + + public AddEntriesFactory(final JComponent parentComponent, + final FileChooserDescriptor descriptor, + final Function mapper) { + myParentComponent = parentComponent; + myDescriptor = descriptor; + myMapper = mapper; + } + + public List create() { + final VirtualFile[] files = FileChooser.chooseFiles(myDescriptor, myParentComponent, null, null); + return files.length == 0 ? null : ContainerUtil.map(files, myMapper); + } + } } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/SinglePathEntry.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/SinglePathEntry.java index 32e71d328eda..7c58f5386368 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/SinglePathEntry.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/SinglePathEntry.java @@ -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. @@ -15,11 +15,9 @@ */ package com.intellij.lang.ant.config.impl; -import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.roots.ui.CellAppearanceEx; import com.intellij.openapi.roots.ui.FileAppearanceService; -import com.intellij.openapi.util.Factory; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.WriteExternalException; import com.intellij.openapi.vfs.LocalFileSystem; @@ -27,7 +25,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.util.Function; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import org.jdom.Element; import org.jetbrains.annotations.NonNls; @@ -36,12 +33,11 @@ import java.io.File; import java.util.List; public class SinglePathEntry implements AntClasspathEntry { - private static final Function CREATE_FROM_VIRTUAL_FILE = - new Function() { - public AntClasspathEntry fun(VirtualFile singlePathEntry) { - return fromVirtulaFile(singlePathEntry); - } - }; + private static final Function CREATE_FROM_VIRTUAL_FILE = new Function() { + public AntClasspathEntry fun(VirtualFile singlePathEntry) { + return fromVirtualFile(singlePathEntry); + } + }; @NonNls static final String PATH = "path"; @@ -77,22 +73,14 @@ public class SinglePathEntry implements AntClasspathEntry { return myFile.getAbsolutePath(); } - public static SinglePathEntry fromVirtulaFile(VirtualFile file) { + private static SinglePathEntry fromVirtualFile(VirtualFile file) { return new SinglePathEntry(file.getPresentableUrl()); } - public static class AddEntriesFactory implements Factory> { - private final JComponent myParentComponent; - + @SuppressWarnings("ClassNameSameAsAncestorName") + public static class AddEntriesFactory extends AntClasspathEntry.AddEntriesFactory { public AddEntriesFactory(final JComponent parentComponent) { - myParentComponent = parentComponent; - } - - public List create() { - VirtualFile[] files = FileChooser.chooseFiles(myParentComponent, new FileChooserDescriptor(false, true, true, true, false, true)); - if (files.length == 0) return null; - return ContainerUtil.map(files, CREATE_FROM_VIRTUAL_FILE); + super(parentComponent, new FileChooserDescriptor(false, true, true, true, false, true), CREATE_FROM_VIRTUAL_FILE); } } } - diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/AntSetPanel.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/AntSetPanel.java index d1b3f3325d56..26fd82b20e7d 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/AntSetPanel.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/AntSetPanel.java @@ -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. @@ -20,6 +20,7 @@ import com.intellij.lang.ant.config.impl.AntInstallation; import com.intellij.lang.ant.config.impl.AntReference; import com.intellij.lang.ant.config.impl.GlobalAntConfiguration; import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; @@ -214,7 +215,8 @@ public class AntSetPanel { } public AntInstallation create() { - VirtualFile file = FileChooser.chooseFile(myParent, FileChooserDescriptorFactory.createSingleFolderDescriptor(), null); + FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); + VirtualFile file = FileChooser.chooseFile(descriptor, myParent, null, null); if (file == null) return null; try { final AntInstallation inst = AntInstallation.fromHome(file.getPresentableUrl()); diff --git a/plugins/copyright/src/com/maddyhome/idea/copyright/ui/CopyrightProfilesPanel.java b/plugins/copyright/src/com/maddyhome/idea/copyright/ui/CopyrightProfilesPanel.java index f931fee8a49e..210735f5f571 100644 --- a/plugins/copyright/src/com/maddyhome/idea/copyright/ui/CopyrightProfilesPanel.java +++ b/plugins/copyright/src/com/maddyhome/idea/copyright/ui/CopyrightProfilesPanel.java @@ -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. @@ -195,7 +195,7 @@ public class CopyrightProfilesPanel extends MasterDetailsComponent implements Se } }; descriptor.setTitle("Choose file containing copyright notice"); - final VirtualFile file = FileChooser.chooseFile(myProject, descriptor); + final VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file == null) return; final List copyrightProfiles = ExternalOptionHelper.loadOptions(VfsUtil.virtualToIoFile(file)); diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CheckoutHelper.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CheckoutHelper.java index 5f477da12fa6..4724478ffd5d 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CheckoutHelper.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/CheckoutHelper.java @@ -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. @@ -77,7 +77,7 @@ public class CheckoutHelper { descriptor.setTitle(CvsBundle.message("dialog.description.select.a.directory.to.check.out.the.files.to")); VirtualFile suggestedCheckoutFolder = LocalFileSystem.getInstance().findFileByPath(pathToSuggestedFolder.replace(File.separatorChar, '/')); - return FileChooser.chooseFile(myPanel, descriptor, suggestedCheckoutFolder); + return FileChooser.chooseFile(descriptor, myPanel, null, suggestedCheckoutFolder); } private boolean requestLocation() { diff --git a/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java b/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java index 324693e97f5e..57c920014b21 100644 --- a/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java +++ b/plugins/devkit/src/projectRoots/IdeaJdkConfigurable.java @@ -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. @@ -113,23 +113,19 @@ public class IdeaJdkConfigurable implements AdditionalDataConfigurable { JPanel wholePanel = new JPanel(new GridBagLayout()); wholePanel.add(mySandboxHomeLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); - wholePanel.add(GuiUtils.constructFieldWithBrowseButton(mySandboxHome, - new ActionListener() { - public void actionPerformed(ActionEvent e) { - FileChooserDescriptor descriptor = FileChooserDescriptorFactory - .createSingleFolderDescriptor(); - descriptor.setTitle(DevKitBundle.message("sandbox.home")); - descriptor.setDescription( - DevKitBundle.message("sandbox.purpose")); - VirtualFile file = FileChooser.chooseFile(mySandboxHome, descriptor, null); - if (file != null) { - mySandboxHome.setText(FileUtil.toSystemDependentName(file.getPath())); - } - myModified = true; - } - }), - new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, - GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0)); + wholePanel.add(GuiUtils.constructFieldWithBrowseButton(mySandboxHome, new ActionListener() { + public void actionPerformed(ActionEvent e) { + FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); + descriptor.setTitle(DevKitBundle.message("sandbox.home")); + descriptor.setDescription(DevKitBundle.message("sandbox.purpose")); + VirtualFile file = FileChooser.chooseFile(descriptor, mySandboxHome, null, null); + if (file != null) { + mySandboxHome.setText(FileUtil.toSystemDependentName(file.getPath())); + } + myModified = true; + } + }), new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, + GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0)); wholePanel.add(myInternalJreLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java index d9ad18c22a24..8bf96f379a02 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importWizard/EclipseImportBuilder.java @@ -347,7 +347,7 @@ public class EclipseImportBuilder extends ProjectImportBuilder implement }; descriptor.setDescription(buf.toString()); descriptor.setTitle(getTitle()); - final VirtualFile selectedFile = FileChooser.chooseFile(project, descriptor, project.getBaseDir()); + final VirtualFile selectedFile = FileChooser.chooseFile(descriptor, project, project.getBaseDir()); if (selectedFile != null) { ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { @@ -387,7 +387,7 @@ public class EclipseImportBuilder extends ProjectImportBuilder implement }; fileChooserDescriptor.setTitle(EclipseBundle.message("eclipse.create.library.title")); fileChooserDescriptor.setDescription(EclipseBundle.message("eclipse.create.library.description", libraryName)); - final VirtualFile file = FileChooser.chooseFile(project, fileChooserDescriptor, null); + final VirtualFile file = FileChooser.chooseFile(fileChooserDescriptor, project, null); if (file != null) { final VirtualFile pluginsDir = file.findChild("plugins"); if (pluginsDir != null) { diff --git a/plugins/git4idea/src/git4idea/actions/GitInit.java b/plugins/git4idea/src/git4idea/actions/GitInit.java index 43aa23976177..f489bcbb312f 100644 --- a/plugins/git4idea/src/git4idea/actions/GitInit.java +++ b/plugins/git4idea/src/git4idea/actions/GitInit.java @@ -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. @@ -64,7 +64,7 @@ public class GitInit extends DumbAwareAction { if (baseDir == null) { baseDir = project.getBaseDir(); } - final VirtualFile root = FileChooser.chooseFile(project, fcd, baseDir); + final VirtualFile root = FileChooser.chooseFile(fcd, project, baseDir); if (root == null) { return; } diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/SelectRepositoryAndShowLogAction.java b/plugins/git4idea/src/git4idea/history/wholeTree/SelectRepositoryAndShowLogAction.java index 2f3c716f5bdf..f597644cf9cc 100644 --- a/plugins/git4idea/src/git4idea/history/wholeTree/SelectRepositoryAndShowLogAction.java +++ b/plugins/git4idea/src/git4idea/history/wholeTree/SelectRepositoryAndShowLogAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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,7 +72,8 @@ public class SelectRepositoryAndShowLogAction extends AnAction { @Override public void actionPerformed(AnActionEvent e) { final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext()); - final VirtualFile[] virtualFiles = FileChooser.chooseFiles(project, new FileChooserDescriptor(false, true, false, true, false, true)); + final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, true, false, true); + final VirtualFile[] virtualFiles = FileChooser.chooseFiles(descriptor, project, null); if (virtualFiles.length == 0) return; if (virtualFiles.length > MAX_REPOS) { VcsBalloonProblemNotifier.showOverVersionControlView(project, "Too many roots (more than " + MAX_REPOS + diff --git a/plugins/git4idea/tests/git4idea/cherrypick/GitCherryPickTest.groovy b/plugins/git4idea/tests/git4idea/cherrypick/GitCherryPickTest.groovy index 832b5adabd83..159828348f8a 100644 --- a/plugins/git4idea/tests/git4idea/cherrypick/GitCherryPickTest.groovy +++ b/plugins/git4idea/tests/git4idea/cherrypick/GitCherryPickTest.groovy @@ -27,17 +27,16 @@ import git4idea.history.browser.CherryPicker import git4idea.history.browser.GitCommit import git4idea.history.browser.SHAHash import git4idea.history.wholeTree.AbstractHash -import git4idea.repo.GitRepository import git4idea.test.GitFastTest import git4idea.test.GitLightRepository import git4idea.test.MockGit +import git4idea.test.MockVcsHelper import sun.security.provider.SHA import static git4idea.test.MockGit.OperationName.CHERRY_PICK +import static git4idea.test.MockGit.commitMessageForCherryPick import static junit.framework.Assert.assertEquals import static junit.framework.Assert.assertTrue -import static git4idea.test.MockGit.commitMessageForCherryPick -import git4idea.test.MockVcsHelper /** * Common parent for all tests on cherry-pick @@ -103,7 +102,7 @@ hint: and commit the result with 'git commit' } void invokeCherryPick(List commits) { - myCherryPicker.cherryPick(Collections.> singletonMap(myRepository, commits)) + myCherryPicker.cherryPick(Collections.singletonMap(myRepository, commits)) } void assertHeadCommit(GitCommit commit) { diff --git a/plugins/git4idea/tests/git4idea/test/MockGit.groovy b/plugins/git4idea/tests/git4idea/test/MockGit.groovy index 1bfae7b0802b..63d93c6e0628 100644 --- a/plugins/git4idea/tests/git4idea/test/MockGit.groovy +++ b/plugins/git4idea/tests/git4idea/test/MockGit.groovy @@ -40,11 +40,6 @@ class MockGit implements Git { public static final GitCommandResult FAKE_SUCCESS_RESULT = new GitCommandResult(true, 0, Collections.emptyList(), Collections.emptyList()) private final Map> myExecutors = new HashMap>() - public static interface OperationExecutor { - GitCommandResult execute(); - OperationName getName(); - } - public enum OperationName { CHERRY_PICK, GET_UNMERGED_FILES; @@ -201,7 +196,7 @@ class MockGit implements Git { return null; } - public static class SimpleErrorOperationExecutor implements MockGit.OperationExecutor { + public static class SimpleErrorOperationExecutor implements OperationExecutor { String myOutput MockGit.OperationName myOperationName @@ -222,7 +217,7 @@ class MockGit implements Git { } } - public static class SimpleSuccessOperationExecutor implements MockGit.OperationExecutor { + public static class SimpleSuccessOperationExecutor implements OperationExecutor { String myOutput MockGit.OperationName myOperationName @@ -274,3 +269,8 @@ class MockGit implements Git { } } + +interface OperationExecutor { + GitCommandResult execute(); + MockGit.OperationName getName(); +} diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleLinkToProjectAction.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleLinkToProjectAction.java index 79d71498b8d0..acfc27b47569 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleLinkToProjectAction.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/action/GradleLinkToProjectAction.java @@ -33,7 +33,7 @@ public class GradleLinkToProjectAction extends AnAction implements DumbAware { if (project == null) { return; } - final VirtualFile file = FileChooser.chooseFile(project, GradleUtil.getFileChooserDescriptor()); + final VirtualFile file = FileChooser.chooseFile(GradleUtil.getFileChooserDescriptor(), project, null); if (file == null) { return; } diff --git a/plugins/groovy/resources/icons/griffon/griffonToolWindow.png b/plugins/groovy/resources/icons/griffon/griffonToolWindow.png new file mode 100644 index 000000000000..999da47e94b8 Binary files /dev/null and b/plugins/groovy/resources/icons/griffon/griffonToolWindow.png differ diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/config/GroovyLibraryDescription.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/config/GroovyLibraryDescription.java index b4d9f5e671a2..242610b1f1a7 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/config/GroovyLibraryDescription.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/config/GroovyLibraryDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -110,7 +110,7 @@ public class GroovyLibraryDescription extends CustomLibraryDescription { }; descriptor.setTitle(myFrameworkName + " SDK"); descriptor.setDescription("Choose a directory containing " + myFrameworkName + " distribution"); - final VirtualFile dir = FileChooser.chooseFile(parentComponent, descriptor, initial); + final VirtualFile dir = FileChooser.chooseFile(descriptor, parentComponent, null, initial); if (dir == null) return null; final GroovyLibraryPresentationProviderBase provider = findManager(dir); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java index ab24014f5952..7c96df71a060 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonFramework.java @@ -55,6 +55,7 @@ import java.util.Map; */ public class GriffonFramework extends MvcFramework { public static final Icon GRIFFON_ICON = IconLoader.getIcon("/icons/griffon/griffon.png"); + public static final Icon GRIFFON_TOOLWINDOW_ICON = IconLoader.getIcon("/icons/griffon/griffonToolWindow.png"); @NonNls private static final String GRIFFON_COMMON_PLUGINS = "-griffonPlugins"; private static final String GLOBAL_PLUGINS_MODULE_NAME = "GriffonGlobalPlugins"; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java index d7c0ffa84c13..c2f7e1ae647d 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonToolWindowFactory.java @@ -92,7 +92,7 @@ public class GriffonToolWindowFactory extends MvcToolWindowDescriptor { @Override public Icon getModuleNodeIcon() { - return GriffonFramework.GRIFFON_ICON; + return GriffonFramework.GRIFFON_TOOLWINDOW_ICON; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java index d04d0a3d5fba..6cda418c5280 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java @@ -1,5 +1,6 @@ /* - * Copyright 2000-2007 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. * You may obtain a copy of the License at @@ -15,6 +16,8 @@ package org.jetbrains.plugins.groovy.mvc; +import com.intellij.execution.ExecutionException; +import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.filters.TextConsoleBuilderFactory; import com.intellij.execution.impl.ConsoleViewImpl; import com.intellij.execution.process.*; @@ -36,7 +39,6 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.*; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindowAnchor; @@ -52,7 +54,6 @@ import org.jetbrains.plugins.groovy.GroovyIcons; import javax.swing.*; import java.awt.*; -import java.io.IOException; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.List; @@ -146,7 +147,7 @@ public class MvcConsole implements Disposable { private static class MyProcessInConsole implements ConsoleProcessDescriptor { final Module module; - final ProcessBuilder pb; + final GeneralCommandLine commandLine; final @Nullable Runnable onDone; final boolean closeOnDone; final boolean showConsole; @@ -156,13 +157,13 @@ public class MvcConsole implements Disposable { private OSProcessHandler myHandler; public MyProcessInConsole(final Module module, - final ProcessBuilder pb, + final GeneralCommandLine commandLine, final Runnable onDone, final boolean showConsole, final boolean closeOnDone, final String[] input) { this.module = module; - this.pb = pb; + this.commandLine = commandLine; this.onDone = onDone; this.closeOnDone = closeOnDone; this.input = input; @@ -204,15 +205,15 @@ public class MvcConsole implements Disposable { } public static ConsoleProcessDescriptor executeProcess(final Module module, - final ProcessBuilder pb, + final GeneralCommandLine commandLine, final @Nullable Runnable onDone, final boolean closeOnDone, final String... input) { - return getInstance(module.getProject()).executeProcess(module, pb, onDone, true, closeOnDone, input); + return getInstance(module.getProject()).executeProcess(module, commandLine, onDone, true, closeOnDone, input); } public ConsoleProcessDescriptor executeProcess(final Module module, - final ProcessBuilder pb, + final GeneralCommandLine commandLine, final @Nullable Runnable onDone, boolean showConsole, final boolean closeOnDone, @@ -220,7 +221,7 @@ public class MvcConsole implements Disposable { ApplicationManager.getApplication().assertIsDispatchThread(); assert module.getProject() == myProject; - final MyProcessInConsole process = new MyProcessInConsole(module, pb, onDone, showConsole, closeOnDone, input); + final MyProcessInConsole process = new MyProcessInConsole(module, commandLine, onDone, showConsole, closeOnDone, input); if (isExecuting()) { myProcessQueue.add(process); } @@ -236,7 +237,7 @@ public class MvcConsole implements Disposable { private void executeProcessImpl(final MyProcessInConsole pic, boolean toFocus) { final Module module = pic.module; - final ProcessBuilder pb = pic.pb; + final GeneralCommandLine commandLine = pic.commandLine; final String[] input = pic.input; final boolean closeOnDone = pic.closeOnDone; final Runnable onDone = pic.onDone; @@ -256,12 +257,10 @@ public class MvcConsole implements Disposable { } FileDocumentManager.getInstance().saveAllDocuments(); - myConsole.print(StringUtil.join(pb.command(), " "), ConsoleViewContentType.SYSTEM_OUTPUT); + myConsole.print(commandLine.getCommandLineString(), ConsoleViewContentType.SYSTEM_OUTPUT); final OSProcessHandler handler; try { - if (pb.command() == null || pb.command().size() == 0) return; - - Process process = pb.start(); + Process process = commandLine.createProcess(); handler = new OSProcessHandler(process, ""); @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") @@ -291,7 +290,7 @@ public class MvcConsole implements Disposable { } }); } - catch (final IOException e) { + catch (final Exception e) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { Messages.showErrorDialog(e.getMessage(), "Cannot Start Process"); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java index c30348f74347..0539d22fe9f0 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcFramework.java @@ -144,10 +144,10 @@ public abstract class MvcFramework { return; } - final ProcessBuilder pb = createCommandAndShowErrors(null, module, true, result == 0 ? "create-app" : "create-plugin"); - if (pb == null) return; + final GeneralCommandLine commandLine = createCommandAndShowErrors(null, module, true, result == 0 ? "create-app" : "create-plugin"); + if (commandLine == null) return; - MvcConsole.executeProcess(module, pb, new Runnable() { + MvcConsole.executeProcess(module, commandLine, new Runnable() { public void run() { VirtualFile root = findAppRoot(module); if (root == null) return; @@ -368,17 +368,17 @@ public abstract class MvcFramework { public abstract String getSdkHomePropertyName(); @Nullable - public ProcessBuilder createCommandAndShowErrors(@NotNull Module module, @NotNull String command, @NotNull String... args) { + public GeneralCommandLine createCommandAndShowErrors(@NotNull Module module, @NotNull String command, @NotNull String... args) { return createCommandAndShowErrors(null, module, command, args); } @Nullable - public ProcessBuilder createCommandAndShowErrors(@Nullable String vmOptions, @NotNull Module module, @NotNull String command, @NotNull String... args) { + public GeneralCommandLine createCommandAndShowErrors(@Nullable String vmOptions, @NotNull Module module, @NotNull String command, @NotNull String... args) { return createCommandAndShowErrors(vmOptions, module, false, command, args); } @Nullable - public ProcessBuilder createCommandAndShowErrors(@Nullable String vmOptions, @NotNull Module module, final boolean forCreation, @NotNull String command, @NotNull String... args) { + public GeneralCommandLine createCommandAndShowErrors(@Nullable String vmOptions, @NotNull Module module, final boolean forCreation, @NotNull String command, @NotNull String... args) { try { return createCommand(module, vmOptions, forCreation, command, args); } @@ -389,23 +389,26 @@ public abstract class MvcFramework { } @NotNull - public ProcessBuilder createCommand(@NotNull Module module, @Nullable String jvmParams, final boolean forCreation, @NotNull String command, @NotNull String... args) - throws ExecutionException { + public GeneralCommandLine createCommand(@NotNull Module module, + @Nullable String jvmParams, + final boolean forCreation, + @NotNull String command, + @NotNull String... args) throws ExecutionException { final JavaParameters params = createJavaParameters(module, forCreation, false, true, jvmParams, command, args); - addJavaHome(params, module); - final ProcessBuilder builder = createProcessBuilder(params); + final GeneralCommandLine commandLine = createCommandLine(params); + final VirtualFile griffonHome = getSdkRoot(module); if (griffonHome != null) { - builder.environment().put(getSdkHomePropertyName(), FileUtil.toSystemDependentName(griffonHome.getPath())); + commandLine.setEnvParams(Collections.singletonMap(getSdkHomePropertyName(), FileUtil.toSystemDependentName(griffonHome.getPath()))); } final VirtualFile root = findAppRoot(module); final File ioRoot = root != null ? VfsUtil.virtualToIoFile(root) : new File(module.getModuleFilePath()).getParentFile(); - builder.directory(forCreation ? ioRoot.getParentFile() : ioRoot); + commandLine.setWorkDirectory(forCreation ? ioRoot.getParentFile() : ioRoot); - return builder; + return commandLine; } public static void addJavaHome(@NotNull JavaParameters params, @NotNull Module module) { @@ -424,20 +427,9 @@ public abstract class MvcFramework { } } - public static ProcessBuilder createProcessBuilder(JavaParameters params) { + public static GeneralCommandLine createCommandLine(@NotNull JavaParameters params) { try { - ProcessBuilder builder = new ProcessBuilder(CommandLineBuilder.createFromJavaParameters(params).getCommands()); - Map env = params.getEnv(); - if (env != null) { - builder.environment().putAll(env); - } - - String workDir = params.getWorkingDirectory(); - if (workDir != null) { - builder.directory(new File(workDir)); - } - - return builder; + return CommandLineBuilder.createFromJavaParameters(params); } catch (CantRunException e) { throw new RuntimeException(e); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTarget.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTarget.java index 9e14bf446be9..a88782104954 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTarget.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcRunTarget.java @@ -1,5 +1,21 @@ +/* + * 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 org.jetbrains.plugins.groovy.mvc; +import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.module.Module; import com.intellij.openapi.util.Pair; @@ -24,10 +40,10 @@ public class MvcRunTarget extends MvcActionBase { Pair parsedCmd = MvcFramework.parsedCmd(targetArgs); - ProcessBuilder pb = framework.createCommandAndShowErrors(dialog.getVmOptions(), selectedModule, parsedCmd.first, parsedCmd.second); - if (pb == null) return; + final GeneralCommandLine commandLine = framework.createCommandAndShowErrors(dialog.getVmOptions(), selectedModule, parsedCmd.first, parsedCmd.second); + if (commandLine == null) return; - MvcConsole.executeProcess(selectedModule, pb, null, false); + MvcConsole.executeProcess(selectedModule, commandLine, null, false); } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgInitDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgInitDialog.java index 5b5d34193881..d936cb12b794 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgInitDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgInitDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -112,7 +112,7 @@ public class HgInitDialog extends DialogWrapper { if (myShowDialog) { super.show(); } else { - mySelectedDir = FileChooser.chooseFile(myProject, myFileDescriptor); + mySelectedDir = FileChooser.chooseFile(myFileDescriptor, myProject, null); } } diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java index d8098c030300..08682576be9e 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -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. @@ -130,7 +130,8 @@ public class JUnitConfigurable extends SettingsEditor implem new BrowseModuleValueActionListener(project) { @Override protected String showDialog() { - final VirtualFile virtualFile = FileChooser.chooseFile(project, FileChooserDescriptorFactory.createSingleFolderDescriptor(), null); + final VirtualFile virtualFile = + FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), project, null); if (virtualFile != null) { return FileUtil.toSystemDependentName(virtualFile.getPath()); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/intentions/ChooseFileIntentionAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/intentions/ChooseFileIntentionAction.java index a3e4a877d2f1..8c4cd780bab0 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/intentions/ChooseFileIntentionAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/intentions/ChooseFileIntentionAction.java @@ -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. @@ -19,8 +19,8 @@ import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.openapi.application.Result; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserDialog; import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; @@ -68,10 +68,8 @@ public class ChooseFileIntentionAction implements IntentionAction { public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { final MavenDomDependency dep = getDependency(file, editor); PsiFile currentValue = dep.getSystemPath().getValue(); - FileChooserDialog dialog = - getFileChooserFactory().createFileChooser(new FileChooserDescriptor(true, false, true, true, false, false), - project); - VirtualFile[] files = dialog.choose(currentValue == null ? null : currentValue.getVirtualFile(), project); + final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, false); + VirtualFile[] files = FileChooser.chooseFiles(descriptor, project, currentValue == null ? null : currentValue.getVirtualFile()); if (files.length == 0) return; final PsiFile selectedFile = PsiManager.getInstance(project).findFile(files[0]); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/AddManagedFilesAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/AddManagedFilesAction.java index bb114a84a933..f4b12b8337f4 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/AddManagedFilesAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/AddManagedFilesAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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. @@ -17,9 +17,8 @@ package org.jetbrains.idea.maven.project.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.openapi.fileChooser.FileChooser; import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserDialog; -import com.intellij.openapi.fileChooser.FileChooserFactory; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.idea.maven.project.MavenProjectsManager; @@ -48,8 +47,7 @@ public class AddManagedFilesAction extends MavenAction { Project project = MavenActionUtil.getProject(e.getDataContext()); VirtualFile fileToSelect = e.getData(PlatformDataKeys.VIRTUAL_FILE); - FileChooserDialog dialog = FileChooserFactory.getInstance().createFileChooser(singlePomSelection, project); - VirtualFile[] files = dialog.choose(fileToSelect, project); + VirtualFile[] files = FileChooser.chooseFiles(singlePomSelection, project, fileToSelect); if (files.length == 0) return; manager.addManagedFiles(Arrays.asList(files)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java index 03b9d3620a2b..38e0f9da83f6 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java @@ -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. @@ -118,7 +118,7 @@ public class SvnConfigurable implements Configurable { String oldValue = PropertiesComponent.getInstance().getValue("FileChooser.showHiddens"); PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", Boolean.TRUE.toString()); - VirtualFile file = FileChooser.chooseFile(myComponent, descriptor, root); + VirtualFile file = FileChooser.chooseFile(descriptor, myComponent, myProject, root); PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", oldValue); if (file == null) { return; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java index 46b01dd3699d..cc8c66ddcd5a 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java @@ -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. @@ -938,7 +938,7 @@ public class RepositoryBrowserDialog extends DialogWrapper { fcd.setTitle(title); fcd.setDescription(description); fcd.setHideIgnored(false); - VirtualFile file = FileChooser.chooseFile(myProject, fcd); + VirtualFile file = FileChooser.chooseFile(fcd, myProject, null); if (file == null) { return null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java index b2c47686b1e7..f74875ffd632 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/CheckoutOptionsDialog.java @@ -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. @@ -57,7 +57,7 @@ public class CheckoutOptionsDialog extends DialogWrapper { private FixedSizeButton mySelectTarget; private final String myRelativePath; - public CheckoutOptionsDialog(Project project, SVNURL url, File target, final VirtualFile root, final String relativePath) { + public CheckoutOptionsDialog(final Project project, SVNURL url, File target, final VirtualFile root, final String relativePath) { super(project, true); myRelativePath = relativePath; final String urlText = url.toString(); @@ -74,7 +74,7 @@ public class CheckoutOptionsDialog extends DialogWrapper { fcd.setTitle(SvnBundle.message("checkout.directory.chooser.title")); fcd.setDescription(SvnBundle.message("checkout.directory.chooser.prompt")); fcd.setHideIgnored(false); - VirtualFile file = FileChooser.chooseFile(getContentPane(), fcd, null); + VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), project, null); if (file == null) { return; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java index de471690e506..1df5567910e9 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DiffOptionsDialog.java @@ -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. @@ -174,7 +174,7 @@ public class DiffOptionsDialog extends DialogWrapper implements ActionListener { fcd.setTitle(title); fcd.setDescription(description); fcd.setHideIgnored(false); - VirtualFile file = FileChooser.chooseFile(myBrowser, fcd); + VirtualFile file = FileChooser.chooseFile(fcd, myBrowser, myProject, null); if (file == null) { return null; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java index 704937199c38..38aff96752bb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ExportOptionsDialog.java @@ -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. @@ -38,6 +38,7 @@ import java.io.File; public class ExportOptionsDialog extends DialogWrapper implements ActionListener { private final SVNURL myURL; + private final Project myProject; private final File myFile; private TextFieldWithBrowseButton myPathField; private DepthCombo myDepth; @@ -48,6 +49,7 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener public ExportOptionsDialog(Project project, SVNURL url, File target) { super(project, true); myURL = url; + myProject = project; myFile = target; setTitle("SVN Export Options"); init(); @@ -170,7 +172,7 @@ public class ExportOptionsDialog extends DialogWrapper implements ActionListener fcd.setTitle("Export Directory"); fcd.setDescription("Select directory to export from subversion"); fcd.setHideIgnored(false); - VirtualFile file = FileChooser.chooseFile(getContentPane(), fcd); + VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), myProject, null); if (file == null) { return; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java index 31924638c548..aba7cf7a09d3 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java @@ -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. @@ -200,7 +200,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener fcd.setTitle("Checkout Directory"); fcd.setDescription("Select directory to checkout from subversion"); fcd.setHideIgnored(false); - VirtualFile file = FileChooser.chooseFile(getContentPane(), fcd); + VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), myProject, null); if (file == null) { return; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java index 6b0a4d924d42..946b4222a18e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/IntegratedSelectedOptionsDialog.java @@ -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. @@ -112,7 +112,7 @@ public class IntegratedSelectedOptionsDialog extends DialogWrapper { } public void actionPerformed(final AnActionEvent e) { - final VirtualFile vFile = FileChooser.chooseFile(myProject, FileChooserDescriptorFactory.createSingleFolderDescriptor()); + final VirtualFile vFile = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), myProject, null); if (vFile != null) { final File file = new File(vFile.getPath()); if (hasDuplicate(file)) { diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/browser/SuiteBrowser.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/browser/SuiteBrowser.java index 95940b9046ad..e9c758d3be1b 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/browser/SuiteBrowser.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/browser/SuiteBrowser.java @@ -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. @@ -41,7 +41,7 @@ public class SuiteBrowser extends BrowseModuleValueActionListener }; descriptor.setDescription("Please select the testng.xml suite file"); descriptor.setTitle("Select Suite"); - VirtualFile file = FileChooser.chooseFile(getProject(), descriptor); + VirtualFile file = FileChooser.chooseFile(descriptor, getProject(), null); return file != null ? file.getPath() : null; } diff --git a/plugins/testng/src/com/theoryinpractice/testng/inspection/UndeclaredTestInspection.java b/plugins/testng/src/com/theoryinpractice/testng/inspection/UndeclaredTestInspection.java index 08b3bce0ad86..9ad0fd1d5682 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/inspection/UndeclaredTestInspection.java +++ b/plugins/testng/src/com/theoryinpractice/testng/inspection/UndeclaredTestInspection.java @@ -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. @@ -202,7 +202,7 @@ public class UndeclaredTestInspection extends BaseJavaLocalInspectionTool { final PsiClass psiClass = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiClass.class); SwingUtilities.invokeLater(new Runnable() { public void run() { - final VirtualFile file = FileChooser.chooseFile(project, FileChooserDescriptorFactory.createSingleFolderDescriptor()); + final VirtualFile file = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), project, null); if (file != null) { final PsiManager psiManager = PsiManager.getInstance(project); final PsiDirectory directory = psiManager.findDirectory(file); diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/AddAssociationAction.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/AddAssociationAction.java index 84371985dab9..c079342b11a0 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/AddAssociationAction.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/associations/impl/AddAssociationAction.java @@ -58,7 +58,7 @@ class AddAssociationAction extends AnAction { } }; - final VirtualFile[] virtualFiles = FileChooser.chooseFiles(project, descriptor, psiFile.getVirtualFile()); + final VirtualFile[] virtualFiles = FileChooser.chooseFiles(descriptor, project, psiFile.getVirtualFile()); if (virtualFiles.length == 0) return; // cancel for (VirtualFile file : virtualFiles) { diff --git a/xml/impl/src/com/intellij/javaee/EditLocationDialog.java b/xml/impl/src/com/intellij/javaee/EditLocationDialog.java index 4cae574c6d7b..f3e7fffdea52 100644 --- a/xml/impl/src/com/intellij/javaee/EditLocationDialog.java +++ b/xml/impl/src/com/intellij/javaee/EditLocationDialog.java @@ -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. @@ -97,7 +97,7 @@ public class EditLocationDialog extends DialogWrapper { new ActionListener() { public void actionPerformed(ActionEvent ignored) { FileChooserDescriptor descriptor = getChooserDescriptor(); - VirtualFile file = FileChooser.chooseFile(myProject, descriptor); + VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null); if (file != null) { myTfPath.setText(file.getPath().replace('/', File.separatorChar)); } diff --git a/xml/impl/src/com/intellij/xml/actions/XmlSplitTagAction.java b/xml/impl/src/com/intellij/xml/actions/XmlSplitTagAction.java index 2daf4c2d01f2..8291ac3d4c9a 100644 --- a/xml/impl/src/com/intellij/xml/actions/XmlSplitTagAction.java +++ b/xml/impl/src/com/intellij/xml/actions/XmlSplitTagAction.java @@ -26,10 +26,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFileFactory; import com.intellij.psi.html.HtmlTag; -import com.intellij.psi.xml.XmlAttribute; -import com.intellij.psi.xml.XmlFile; -import com.intellij.psi.xml.XmlTag; -import com.intellij.psi.xml.XmlText; +import com.intellij.psi.xml.*; import com.intellij.util.IncorrectOperationException; import com.intellij.xml.XmlBundle; import org.jetbrains.annotations.NotNull; @@ -94,8 +91,22 @@ public class XmlSplitTagAction implements IntentionAction { final XmlTag xmlTag = (XmlTag)containingTag; final String s = xmlText.getText(); - final String first = s.substring(0, offsetInElement); - final String second = s.substring(offsetInElement); + String first = s.substring(0, offsetInElement); + String second = s.substring(offsetInElement); + + if (xmlText instanceof XmlTagChild) { + XmlTagChild prev = ((XmlTagChild)xmlText).getPrevSiblingInTag(); + while(prev != null) { + first = prev.getText() + first; + prev = prev.getPrevSiblingInTag(); + } + + XmlTagChild next = ((XmlTagChild)xmlText).getNextSiblingInTag(); + while(next != null) { + second += next.getText(); + next = next.getNextSiblingInTag(); + } + } final String filetext = buildNewText(xmlTag, first, second); diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java index c1a7e5ec7fc1..cdde9af2d021 100644 --- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java +++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java @@ -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. @@ -15,22 +15,21 @@ */ package com.intellij.xml.actions.xmlbeans; +import com.intellij.javaee.ExternalResourceManager; +import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.TextFieldWithBrowseButton; -import com.intellij.openapi.fileChooser.FileChooserDescriptor; -import com.intellij.openapi.fileChooser.FileChooserDialog; -import com.intellij.openapi.fileChooser.FileChooserFactory; -import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.util.SystemInfo; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.xml.XmlBundle; -import com.intellij.javaee.ExternalResourceManager; -import java.awt.event.ActionListener; import java.awt.event.ActionEvent; -import java.util.List; +import java.awt.event.ActionListener; import java.util.Arrays; +import java.util.List; /** * @author Konstantin Bulenkov @@ -62,11 +61,6 @@ public class UIUtils { fileChooserDescriptor.setTitle(selectFileDialogTitle); - final FileChooserDialog fileChooser = FileChooserFactory.getInstance().createFileChooser( - fileChooserDescriptor, - myProject - ); - VirtualFile initialFile = myProject.getBaseDir(); String selectedItem = wsdlUrl.getTextField().getText(); if (selectedItem != null && selectedItem.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) { @@ -74,7 +68,7 @@ public class UIUtils { if (fileByPath != null) initialFile = fileByPath; } - final VirtualFile[] virtualFiles = fileChooser.choose(initialFile, myProject); + final VirtualFile[] virtualFiles = FileChooser.chooseFiles(fileChooserDescriptor, myProject, initialFile); if (virtualFiles.length == 1) { String url = fixIDEAUrl(virtualFiles[0].getUrl()); wsdlUrl.setText(url); diff --git a/xml/openapi/src/com/intellij/javaee/UriUtil.java b/xml/openapi/src/com/intellij/javaee/UriUtil.java index 1e11b9dfed41..6ae54dceb1a0 100644 --- a/xml/openapi/src/com/intellij/javaee/UriUtil.java +++ b/xml/openapi/src/com/intellij/javaee/UriUtil.java @@ -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. @@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable; public class UriUtil { private UriUtil() {} - /** @see #findRelativeFile(String, com.intellij.psi.PsiFile) */ + /** @see #findRelative(String, com.intellij.psi.PsiFileSystemItem) */ @Deprecated @Nullable public static VirtualFile findRelativeFile(String uri, VirtualFile base) {