diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/CompositePackagingElementNode.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/CompositePackagingElementNode.java index b252e4442253..03a982701560 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/CompositePackagingElementNode.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/nodes/CompositePackagingElementNode.java @@ -51,7 +51,7 @@ public class CompositePackagingElementNode extends PackagingElementNode>()); } - return children.toArray(new SimpleNode[children.size()]); + return children.isEmpty() ? NO_CHILDREN : children.toArray(new SimpleNode[children.size()]); } @Override diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/sourceItems/SourceItemNodeBase.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/sourceItems/SourceItemNodeBase.java index 212c9582b757..359ee783a476 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/sourceItems/SourceItemNodeBase.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/sourceItems/SourceItemNodeBase.java @@ -71,7 +71,7 @@ public abstract class SourceItemNodeBase extends ArtifactsTreeNode { } } } - return children.toArray(new SimpleNode[children.size()]); + return children.isEmpty() ? NO_CHILDREN : children.toArray(new SimpleNode[children.size()]); } @Nullable diff --git a/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java b/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java index eecf8f0a6e58..d203f7aa8d85 100644 --- a/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java +++ b/java/java-impl/src/com/intellij/javadoc/JavadocConfiguration.java @@ -224,11 +224,11 @@ public class JavadocConfiguration implements ModuleRunProfile, JDOMExternalizabl final PathsList classPath; if (jdk.getSdkType() instanceof JavaSdk) { - classPath = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutThisModuleContent().getPathsList(); + classPath = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutModuleSourceEntries().getPathsList(); } else { //libraries are included into jdk - classPath = OrderEnumerator.orderEntries(myProject).withoutThisModuleContent().getPathsList(); + classPath = OrderEnumerator.orderEntries(myProject).withoutModuleSourceEntries().getPathsList(); } final String classPathString = classPath.getPathsString(); if (classPathString.length() > 0) { diff --git a/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java b/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java index 25f2a3e6f3f9..d1dfb59d57af 100644 --- a/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java +++ b/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java @@ -35,7 +35,7 @@ import javax.swing.*; import java.util.*; public class JavaColorSettingsPage implements ColorSettingsPage, InspectionColorSettingsPage { - private static final AttributesDescriptor[] ourDescriptors = new AttributesDescriptor[] { + private static final AttributesDescriptor[] ourDescriptors = { new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.keyword"), SyntaxHighlighterColors.KEYWORD), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.number"), SyntaxHighlighterColors.NUMBER), @@ -82,8 +82,6 @@ public class JavaColorSettingsPage implements ColorSettingsPage, InspectionColor new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.annotation.attribute.name"), CodeInsightColors.ANNOTATION_ATTRIBUTE_NAME_ATTRIBUTES) }; - private static final ColorDescriptor[] ourColorDescriptors = new ColorDescriptor[0]; - @NonNls private static final Map ourTags = new HashMap(); static { ourTags.put("field", CodeInsightColors.INSTANCE_FIELD_ATTRIBUTES); @@ -135,7 +133,7 @@ public class JavaColorSettingsPage implements ColorSettingsPage, InspectionColor @NotNull public ColorDescriptor[] getColorDescriptors() { - return ourColorDescriptors; + return ColorDescriptor.EMPTY_ARRAY; } @NotNull diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java b/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java index c2942aefeae0..07493a68eeba 100644 --- a/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java +++ b/java/java-impl/src/com/intellij/openapi/roots/impl/CompilerModuleExtensionImpl.java @@ -300,13 +300,15 @@ public class CompilerModuleExtensionImpl extends CompilerModuleExtension { OrderRootType.COMPILATION_CLASSES.equals(type) || OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type)) { final ArrayList result = new ArrayList(); + + final VirtualFile outputPathForTests = OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type) ? null : getCompilerOutputPathForTests(); + if (outputPathForTests != null) { + result.add(outputPathForTests); + } + VirtualFile outputRoot = getCompilerOutputPath(); - if (outputRoot != null) result.add(outputRoot); - if (!OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type)) { - final VirtualFile outputPathForTests = getCompilerOutputPathForTests(); - if (outputPathForTests != null && !outputPathForTests.equals(outputRoot)) { - result.add(outputPathForTests); - } + if (outputRoot != null && !outputRoot.equals(outputPathForTests)) { + result.add(outputRoot); } return VfsUtil.toVirtualFileArray(result); } @@ -319,13 +321,15 @@ public class CompilerModuleExtensionImpl extends CompilerModuleExtension { OrderRootType.COMPILATION_CLASSES.equals(type) || OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type)) { final List result = new ArrayList(); + + final String outputPathForTests = OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type) ? null : getCompilerOutputUrlForTests(); + if (outputPathForTests != null) { + result.add(outputPathForTests); + } + String outputRoot = getCompilerOutputUrl(); - if (outputRoot != null) result.add(outputRoot); - if (!OrderRootType.PRODUCTION_COMPILATION_CLASSES.equals(type)) { - final String outputPathForTests = getCompilerOutputUrlForTests(); - if (outputPathForTests != null && !outputPathForTests.equals(outputRoot)) { - result.add(outputPathForTests); - } + if (outputRoot != null && !outputRoot.equals(outputPathForTests)) { + result.add(outputRoot); } return ArrayUtil.toStringArray(result); } diff --git a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.java b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.java index f99f24f8d252..7238fb8feccd 100644 --- a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.java @@ -15,7 +15,6 @@ */ package com.intellij.psi.impl.compiled; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; @@ -35,8 +34,6 @@ import org.jetbrains.annotations.NotNull; import java.util.Map; public class ClsJavaCodeReferenceElementImpl extends ClsElementImpl implements PsiJavaCodeReferenceElement { - private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl"); - private final PsiElement myParent; private final String myCanonicalText; private final String myQualifiedName; @@ -44,6 +41,7 @@ public class ClsJavaCodeReferenceElementImpl extends ClsElementImpl implements P private volatile PsiType[] myTypeParametersCachedTypes = null; // in left-to-right-order @NonNls private static final String EXTENDS_PREFIX = "?extends"; @NonNls private static final String SUPER_PREFIX = "?super"; + public static final ClsJavaCodeReferenceElementImpl[] EMPTY_ARRAY = new ClsJavaCodeReferenceElementImpl[0]; public ClsJavaCodeReferenceElementImpl(PsiElement parent, String canonicalText) { myParent = parent; diff --git a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java index 0bc557db33ec..dd93dc09989a 100644 --- a/java/java-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java @@ -36,10 +36,12 @@ public class ClsReferenceListImpl extends ClsRepositoryPsiElement R processOrder(RootPolicy policy, R initialValue); /** - * @since 10 + * Returns {@link OrderEnumerator} instance which can be used to process order entries of the module (with or without dependencies) and + * collect classes or source roots + * + * @return {@link OrderEnumerator} instance + * @since 10.0 */ @NotNull OrderEnumerator orderEntries(); diff --git a/platform/lang-api/src/com/intellij/openapi/roots/OrderEnumerator.java b/platform/lang-api/src/com/intellij/openapi/roots/OrderEnumerator.java index adc0c981d706..da1fcadfc0d9 100644 --- a/platform/lang-api/src/com/intellij/openapi/roots/OrderEnumerator.java +++ b/platform/lang-api/src/com/intellij/openapi/roots/OrderEnumerator.java @@ -27,41 +27,115 @@ import org.jetbrains.annotations.NotNull; import java.util.Collection; /** + * Interface for convenient processing dependencies of a module or a project. Allows to process {@link OrderEntry}s and collect classes + * and source roots + * + * Use {@link #orderEntries(com.intellij.openapi.module.Module)} or {@link ModuleRootModel#orderEntries()} to process dependencies of a module + * and use {@link #orderEntries(com.intellij.openapi.project.Project)} to process dependencies of all modules in a project + * + * @since 10.0 + * + * * @author nik */ public abstract class OrderEnumerator { + /** + * Skip test dependencies + * @return this instance + */ public abstract OrderEnumerator productionOnly(); + /** + * Skip runtime-only dependencies + * @return this instance + */ public abstract OrderEnumerator compileOnly(); - public abstract OrderEnumerator runtimeOnly(); + /** + * Skip compile-only dependencies + * @return this instance + */ + public abstract OrderEnumerator runtimeOnly(); public abstract OrderEnumerator withoutSdk(); public abstract OrderEnumerator withoutLibraries(); public abstract OrderEnumerator withoutDepModules(); - public abstract OrderEnumerator withoutThisModuleContent(); + public abstract OrderEnumerator withoutModuleSourceEntries(); + /** + * Recursively process modules on which the module depends + * @return this instance + */ public abstract OrderEnumerator recursively(); + + /** + * Skip not exported dependencies. If this method is called after {@link #recursively()} then + * @return this instance + */ public abstract OrderEnumerator exportedOnly(); + /** + * Process only entries which satisfies the specified condition + * @param condition filtering condition + * @return this instance + */ public abstract OrderEnumerator satisfying(Condition condition); - + /** + * @return classes roots for all entries processed by this enumerator + */ public abstract Collection getClassesRoots(); + + /** + * @return source roots for all entries processed by this enumerator + */ public abstract Collection getSourceRoots(); + /** + * @return list containing classes roots for all entries processed by this enumerator + */ public abstract PathsList getPathsList(); + + /** + * Add classes roots for all entries processed by this enumerator + * @param list list to append paths + */ public abstract void collectPaths(PathsList list); + + /** + * @return list containing source roots for all entries processed by this enumerator + */ public abstract PathsList getSourcePathsList(); + + /** + * Add source roots for all entries processed by this enumerator + * @param list list to append paths + */ public abstract void collectSourcePaths(PathsList list); + /** + * Runs processor.process() for each entry processed by this enumerator. + * @param processor processor + */ public abstract void forEach(Processor processor); + public abstract void forEachLibrary(Processor processor); + /** + * Creates new enumerator instance to process dependencies of module + * @param module module + * @return new enumerator instance + */ public static OrderEnumerator orderEntries(@NotNull Module module) { return ModuleRootManager.getInstance(module).orderEntries(); } + /** + * Creates new enumerator instance to process dependencies of all modules in project. Only first level dependencies of + * modules are processed so {@link #recursively()} option is ignored and {@link #withoutDepModules()} option is forced + * @param project project + * @return new enumerator instance + */ public static OrderEnumerator orderEntries(@NotNull Project project) { return ProjectRootManager.getInstance(project).orderEntries(); } diff --git a/platform/lang-api/src/com/intellij/openapi/roots/OrderRootType.java b/platform/lang-api/src/com/intellij/openapi/roots/OrderRootType.java index a73508064e04..0d6eeeb1759a 100644 --- a/platform/lang-api/src/com/intellij/openapi/roots/OrderRootType.java +++ b/platform/lang-api/src/com/intellij/openapi/roots/OrderRootType.java @@ -42,7 +42,7 @@ public class OrderRootType { * Runtime classpath. * Includes: *
  • production and test output for modules - *
  • classes roots for libraries unless scope is 'provided' + *
  • classes roots for libraries and jdk unless scope is 'provided' *
  • recursively for module dependencies with scope != 'provided' */ public static final OrderRootType CLASSES_AND_OUTPUT = new OrderRootType("CLASSES_AND_OUTPUT"); @@ -51,7 +51,7 @@ public class OrderRootType { * Classpath for compilation. * Includes: *
  • production and test output for modules - *
  • classes roots for libraries + *
  • classes roots for libraries and jdk *
  • recursively for module dependencies: only exported items */ public static final OrderRootType COMPILATION_CLASSES = new OrderRootType("COMPILATION_CLASSES"); @@ -60,7 +60,7 @@ public class OrderRootType { * Classpath for compilation without tests. * Includes: *
  • production output for modules - *
  • classes roots for libraries with scope suitable for production compile + *
  • classes roots for libraries and jdk with scope suitable for production compile *
  • recursively for module dependencies with scope suitable for production compile: only exported items */ public static final OrderRootType PRODUCTION_COMPILATION_CLASSES = new OrderRootType("PRODUCTION_COMPILATION_CLASSES"); @@ -68,7 +68,7 @@ public class OrderRootType { /** * Classpath without output directories for this module. * Includes: - *
  • classes roots for libraries + *
  • classes roots for libraries and jdk *
  • recursively for module dependencies: only exported items */ public static final OrderRootType CLASSES = new PersistentOrderRootType("CLASSES", "classPath", null, "classPathEntry"); @@ -77,6 +77,7 @@ public class OrderRootType { * Sources. * Includes: *
  • production and test source roots for modules + *
  • source roots for libraries and jdk *
  • recursively for module dependencies: only exported items */ public static final OrderRootType SOURCES = new PersistentOrderRootType("SOURCES", "sourcePath", null, "sourcePathEntry"); diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateManagerImpl.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateManagerImpl.java index d0f28ce7a50c..a3ff15a6dee0 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateManagerImpl.java @@ -63,6 +63,7 @@ import java.util.*; * _inside_, not outside of the read action */ public class FileTemplateManagerImpl extends FileTemplateManager implements ExportableComponent, JDOMExternalizable { + private static final FileTemplateManagerImpl[] EMPTY_ARRAY = new FileTemplateManagerImpl[0]; private static final Logger LOG = Logger.getInstance("#com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl"); @NonNls private static final String DEFAULT_TEMPLATE_EXTENSION = "ft"; @NonNls private static final String TEMPLATES_DIR = "fileTemplates"; @@ -137,7 +138,7 @@ public class FileTemplateManagerImpl extends FileTemplateManager implements Expo myPatternsManager = patternsManager; myCodeTemplatesManager = codeTemplatesManager; myJ2eeTemplatesManager = j2eeTemplatesManager; - myChildren = internalTemplatesManager == null ? new FileTemplateManagerImpl[0] : new FileTemplateManagerImpl[]{internalTemplatesManager,patternsManager,codeTemplatesManager,j2eeTemplatesManager}; + myChildren = internalTemplatesManager == null ? EMPTY_ARRAY : new FileTemplateManagerImpl[]{internalTemplatesManager,patternsManager,codeTemplatesManager,j2eeTemplatesManager}; if (ApplicationManager.getApplication().isUnitTestMode() && defaultTemplatesDirName.equals(INTERNAL_DIR)) { for (String tname : Arrays.asList("Class", "AnnotationType", "Enum", "Interface")) { diff --git a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/CustomColorsPage.java b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/CustomColorsPage.java index aa5ac7a02351..3149ba45c3a2 100644 --- a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/CustomColorsPage.java +++ b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/CustomColorsPage.java @@ -32,8 +32,7 @@ import javax.swing.*; import java.util.Map; public class CustomColorsPage implements ColorSettingsPage { - private static final ColorDescriptor[] COLORS = new ColorDescriptor[0]; - private static final AttributesDescriptor[] ATTRS = new AttributesDescriptor[] { + private static final AttributesDescriptor[] ATTRS = { new AttributesDescriptor(OptionsBundle.message("options.custom.attribute.descriptor.keyword1"), CustomHighlighterColors.CUSTOM_KEYWORD1_ATTRIBUTES), new AttributesDescriptor(OptionsBundle.message("options.custom.attribute.descriptor.keyword2"), CustomHighlighterColors.CUSTOM_KEYWORD2_ATTRIBUTES), new AttributesDescriptor(OptionsBundle.message("options.custom.attribute.descriptor.keyword3"), CustomHighlighterColors.CUSTOM_KEYWORD3_ATTRIBUTES), @@ -46,7 +45,7 @@ public class CustomColorsPage implements ColorSettingsPage { new AttributesDescriptor(OptionsBundle.message("options.custom.attribute.descriptor.invalid.string.escape"), CustomHighlighterColors.CUSTOM_INVALID_STRING_ESCAPE), }; - @NonNls private final static SyntaxTable SYNTAX_TABLE = new SyntaxTable(); + @NonNls private static final SyntaxTable SYNTAX_TABLE = new SyntaxTable(); static { SYNTAX_TABLE.setLineComment("#"); SYNTAX_TABLE.setStartComment("/*"); @@ -81,7 +80,7 @@ public class CustomColorsPage implements ColorSettingsPage { @NotNull public ColorDescriptor[] getColorDescriptors() { - return COLORS; + return ColorDescriptor.EMPTY_ARRAY; } @NotNull diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/ex/ProjectRootContainer.java b/platform/lang-impl/src/com/intellij/openapi/projectRoots/ex/ProjectRootContainer.java index e0cb26210473..1a2a69bd1477 100644 --- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/ex/ProjectRootContainer.java +++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/ex/ProjectRootContainer.java @@ -30,20 +30,21 @@ import org.jetbrains.annotations.NotNull; public interface ProjectRootContainer { @NotNull - VirtualFile[] getRootFiles(OrderRootType type); - ProjectRoot[] getRoots(OrderRootType type); + VirtualFile[] getRootFiles(@NotNull OrderRootType type); + @NotNull ProjectRoot[] getRoots(@NotNull OrderRootType type); void startChange(); void finishChange(); - ProjectRoot addRoot(VirtualFile virtualFile, OrderRootType type); - void addRoot(ProjectRoot root, OrderRootType type); - void removeRoot(ProjectRoot root, OrderRootType type); - void removeAllRoots(OrderRootType type); + @NotNull + ProjectRoot addRoot(@NotNull VirtualFile virtualFile, @NotNull OrderRootType type); + void addRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type); + void removeRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type); + void removeAllRoots(@NotNull OrderRootType type); void removeAllRoots(); - void removeRoot(VirtualFile root, OrderRootType type); + void removeRoot(@NotNull VirtualFile root, @NotNull OrderRootType type); void update(); } diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootContainerImpl.java b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootContainerImpl.java index 82ad950ba239..438e458d8e6b 100644 --- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootContainerImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootContainerImpl.java @@ -62,11 +62,12 @@ public class ProjectRootContainerImpl implements JDOMExternalizable, ProjectRoot } @NotNull - public VirtualFile[] getRootFiles(OrderRootType type) { + public VirtualFile[] getRootFiles(@NotNull OrderRootType type) { return myFiles.get(type); } - public ProjectRoot[] getRoots(OrderRootType type) { + @NotNull + public ProjectRoot[] getRoots(@NotNull OrderRootType type) { return myRoots.get(type).getProjectRoots(); } @@ -116,27 +117,28 @@ public class ProjectRootContainerImpl implements JDOMExternalizable, ProjectRoot } - public void removeRoot(ProjectRoot root, OrderRootType type) { + public void removeRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type) { LOG.assertTrue(myInsideChange); myRoots.get(type).remove(root); } - public ProjectRoot addRoot(VirtualFile virtualFile, OrderRootType type) { + @NotNull + public ProjectRoot addRoot(@NotNull VirtualFile virtualFile, @NotNull OrderRootType type) { LOG.assertTrue(myInsideChange); return myRoots.get(type).add(virtualFile); } - public void addRoot(ProjectRoot root, OrderRootType type) { + public void addRoot(@NotNull ProjectRoot root, @NotNull OrderRootType type) { LOG.assertTrue(myInsideChange); myRoots.get(type).add(root); } - public void removeAllRoots(OrderRootType type ) { + public void removeAllRoots(@NotNull OrderRootType type ) { LOG.assertTrue(myInsideChange); myRoots.get(type).clear(); } - public void removeRoot(VirtualFile root, OrderRootType type) { + public void removeRoot(@NotNull VirtualFile root, @NotNull OrderRootType type) { LOG.assertTrue(myInsideChange); myRoots.get(type).remove(root); } diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SimpleProjectRoot.java b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SimpleProjectRoot.java index 2a573f725796..62a0dbce48cb 100644 --- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SimpleProjectRoot.java +++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SimpleProjectRoot.java @@ -26,6 +26,7 @@ import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.openapi.vfs.ex.http.HttpFileSystem; import org.jdom.Element; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.io.File; @@ -39,12 +40,12 @@ public class SimpleProjectRoot implements ProjectRoot, JDOMExternalizable { private boolean myInitialized = false; @NonNls private static final String ATTRIBUTE_URL = "url"; - SimpleProjectRoot(VirtualFile file) { + SimpleProjectRoot(@NotNull VirtualFile file) { myFile = file; myUrl = myFile.getUrl(); } - public SimpleProjectRoot(String url) { + public SimpleProjectRoot(@NotNull String url) { myUrl = url; } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java index 29b8138e4cca..7a5ef993f838 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java @@ -94,7 +94,7 @@ public abstract class OrderEnumeratorBase extends OrderEnumerator { } @Override - public OrderEnumerator withoutThisModuleContent() { + public OrderEnumerator withoutModuleSourceEntries() { myWithoutThisModuleContent = true; return this; } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java index d86a45b9d49b..2012fabe49e6 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/PsiManagerImpl.java @@ -56,6 +56,7 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl; import com.intellij.psi.search.PsiSearchHelper; import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiModificationTracker; +import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil; import com.intellij.testFramework.LightVirtualFile; import com.intellij.util.IncorrectOperationException; import com.intellij.util.ThrowableRunnable; @@ -765,27 +766,7 @@ public class PsiManagerImpl extends PsiManagerEx implements ProjectComponent { //element.checkDelete(); //move != delete + add newContainer.checkAdd(element); - checkIfMoveIntoSelf(element, newContainer); - } - - private static void checkIfMoveIntoSelf(PsiElement element, PsiElement newContainer) throws IncorrectOperationException { - PsiElement container = newContainer; - while (container != null) { - if (container == element) { - if (element instanceof PsiDirectory) { - if (element == newContainer) { - throw new IncorrectOperationException("Cannot place directory into itself."); - } - else { - throw new IncorrectOperationException("Cannot place directory into its subdirectory."); - } - } - else { - throw new IncorrectOperationException(); - } - } - container = container.getParent(); - } + MoveFilesOrDirectoriesUtil.checkIfMoveIntoSelf(element, newContainer); } public void startBatchFilesProcessingMode() { diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java index 0640c86849d7..8ae866c773b8 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java @@ -82,7 +82,7 @@ public class ReferenceProvidersRegistry extends PsiReferenceRegistrar { }; private final Project myProject; - private final static NotNullLazyKey INSTANCE_CACHE = + private static final NotNullLazyKey INSTANCE_CACHE = ServiceManager.createLazyKey(ReferenceProvidersRegistry.class); public static ReferenceProvidersRegistry getInstance(Project project) { @@ -267,7 +267,6 @@ public class ReferenceProvidersRegistry extends PsiReferenceRegistrar { } } } - return ContainerUtil.toArray(result, new PsiReference[result.size()]); + return result.isEmpty() ? PsiReference.EMPTY_ARRAY : ContainerUtil.toArray(result, new PsiReference[result.size()]); } - } diff --git a/platform/lang-impl/src/com/intellij/refactoring/copy/CopyFilesOrDirectoriesHandler.java b/platform/lang-impl/src/com/intellij/refactoring/copy/CopyFilesOrDirectoriesHandler.java index 81a5e1243c36..287f49d36341 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/copy/CopyFilesOrDirectoriesHandler.java +++ b/platform/lang-impl/src/com/intellij/refactoring/copy/CopyFilesOrDirectoriesHandler.java @@ -29,6 +29,7 @@ import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.refactoring.RefactoringBundle; +import com.intellij.refactoring.move.moveFilesOrDirectories.MoveFilesOrDirectoriesUtil; import com.intellij.refactoring.util.CommonRefactoringUtil; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; @@ -80,6 +81,7 @@ public class CopyFilesOrDirectoriesHandler implements CopyHandlerDelegate { if (dialog.isOK()) { final String newName = elements.length == 1 ? dialog.getNewName() : null; final PsiManager psiManager = PsiManager.getInstance(project); + final PsiDirectory targetDirectory = dialog.getTargetDirectory(); try { for (PsiElement element : elements) { PsiFileSystemItem psiElement = (PsiFileSystemItem)element; @@ -87,18 +89,19 @@ public class CopyFilesOrDirectoriesHandler implements CopyHandlerDelegate { if (!psiElement.isDirectory()) { psiElement = (PsiFileSystemItem)psiElement.copy(); psiElement.setName(newName); + psiManager.checkMove(psiElement, targetDirectory); } else { - dialog.getTargetDirectory().checkCreateSubdirectory(newName); + targetDirectory.checkCreateSubdirectory(newName); + MoveFilesOrDirectoriesUtil.checkIfMoveIntoSelf(psiElement, targetDirectory); } } - psiManager.checkMove(psiElement, dialog.getTargetDirectory()); } } catch (IncorrectOperationException e) { CommonRefactoringUtil.showErrorHint(project, null, e.getMessage(), CommonBundle.getErrorTitle(), null); return; } - copyImpl(elements, newName, dialog.getTargetDirectory(), false); + copyImpl(elements, newName, targetDirectory, false); } } diff --git a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesUtil.java b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesUtil.java index 1487805e7fdd..3153b7e58dce 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesUtil.java +++ b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesUtil.java @@ -177,4 +177,24 @@ public class MoveFilesOrDirectoriesUtil { return null; } } + + public static void checkIfMoveIntoSelf(PsiElement element, PsiElement newContainer) throws IncorrectOperationException { + PsiElement container = newContainer; + while (container != null) { + if (container == element) { + if (element instanceof PsiDirectory) { + if (element == newContainer) { + throw new IncorrectOperationException("Cannot place directory into itself."); + } + else { + throw new IncorrectOperationException("Cannot place directory into its subdirectory."); + } + } + else { + throw new IncorrectOperationException(); + } + } + container = container.getParent(); + } + } } diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/AnAction.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/AnAction.java index c45a1d6f4c0f..737598ea17a7 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/AnAction.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/AnAction.java @@ -67,7 +67,7 @@ public abstract class AnAction { private boolean myEnabledInModalContext; - private static final ShortcutSet ourEmptyShortcutSet = new CustomShortcutSet(new Shortcut[0]); + private static final ShortcutSet ourEmptyShortcutSet = new CustomShortcutSet(); private boolean myIsDefaultIcon = true; private boolean myWorksInInjected; diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java index ce284244cec9..9f23aae21319 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java @@ -39,10 +39,10 @@ public final class CustomShortcutSet implements ShortcutSet { * @param shortcuts keyboard shortcuts */ public CustomShortcutSet(Shortcut... shortcuts){ - myShortcuts = (Shortcut[])shortcuts.clone(); + myShortcuts = shortcuts.length == 0 ? Shortcut.EMPTY_ARRAY : shortcuts.clone(); } public Shortcut[] getShortcuts(){ - return (Shortcut[])myShortcuts.clone(); + return myShortcuts.length == 0 ? Shortcut.EMPTY_ARRAY : myShortcuts.clone(); } } \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/Shortcut.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/Shortcut.java index 019aec6fda04..f62581cd05f6 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/Shortcut.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/Shortcut.java @@ -23,6 +23,7 @@ import com.intellij.openapi.keymap.KeymapUtil; * @see ShortcutSet */ public abstract class Shortcut { + public static final Shortcut[] EMPTY_ARRAY = new Shortcut[0]; Shortcut(){ } diff --git a/platform/platform-api/src/com/intellij/openapi/options/StreamProvider.java b/platform/platform-api/src/com/intellij/openapi/options/StreamProvider.java index e62ecf0d4c3a..ae1e9747972a 100644 --- a/platform/platform-api/src/com/intellij/openapi/options/StreamProvider.java +++ b/platform/platform-api/src/com/intellij/openapi/options/StreamProvider.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.io.InputStream; public interface StreamProvider { + StreamProvider[] EMPTY_ARRAY = new StreamProvider[0]; StreamProvider DEFAULT = new StreamProvider(){ public void saveContent(final String fileSpec, final InputStream content, final long size, final RoamingType roamingType, boolean async) throws IOException { diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleMutableNode.java b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleMutableNode.java index 4d65e970fa96..b0ac36ece49c 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleMutableNode.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/SimpleMutableNode.java @@ -23,7 +23,7 @@ import java.util.List; public abstract class SimpleMutableNode extends CachingSimpleNode { - private final List myChildren = new ArrayList(); + private final List myChildren = new ArrayList(); public SimpleMutableNode() { } @@ -37,7 +37,7 @@ public abstract class SimpleMutableNode extends CachingSimpleNode { } protected final SimpleNode[] buildChildren() { - return (SimpleNode[]) myChildren.toArray(new SimpleNode[myChildren.size()]); + return myChildren.isEmpty() ? NO_CHILDREN : myChildren.toArray(new SimpleNode[myChildren.size()]); } public final SimpleNode add(SimpleNode child) { @@ -48,8 +48,8 @@ public abstract class SimpleMutableNode extends CachingSimpleNode { public final SimpleNode[] addAll(SimpleNode[] children) { - for (int i = 0; i < children.length; i++) { - add(children[i]); + for (SimpleNode aChildren : children) { + add(aChildren); } return children; diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.java b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.java index 2f0b19c46306..e182f56ecea7 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/filtered/FilteringTreeStructure.java @@ -164,7 +164,7 @@ public class FilteringTreeStructure extends AbstractTreeStructure { } protected SimpleNode[] buildChildren() { - return myChildren.toArray(new SimpleNode[myChildren.size()]); + return myChildren.isEmpty() ? NO_CHILDREN : myChildren.toArray(new SimpleNode[myChildren.size()]); } public Object[] getEqualityObjects() { diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java index cfda7c873e1b..54d6b8b5250a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StateStorageManagerImpl.java @@ -332,7 +332,7 @@ public abstract class StateStorageManagerImpl implements StateStorageManager, Di public StreamProvider[] getStreamProviders(RoamingType type) { synchronized (myStreamProviders) { final Collection providers = myStreamProviders.get(type); - return providers.toArray(new StreamProvider[providers.size()]); + return providers.isEmpty() ? EMPTY_ARRAY : providers.toArray(new StreamProvider[providers.size()]); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java index e1ee5da5922c..54b6f64bd217 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java @@ -450,7 +450,7 @@ public class FoldingModelImpl implements FoldingModelEx, PrioritizedDocumentList } } - myCachedVisible = visible.toArray(new FoldRegion[visible.size()]); + myCachedVisible = visible.isEmpty() ? FoldRegion.EMPTY_ARRAY : visible.toArray(new FoldRegion[visible.size()]); Arrays.sort(myCachedVisible, BY_END_OFFSET_REVERSE); diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java index 9fd40c39fac4..1991b02eb89e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/KeymapImpl.java @@ -516,7 +516,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme { return ourEmptyShortcutsArray; } } - return shortcuts.toArray(new Shortcut[shortcuts.size()]); + return shortcuts.isEmpty() ? ourEmptyShortcutsArray : shortcuts.toArray(new Shortcut[shortcuts.size()]); } private KeymapManagerEx getKeymapManager() { diff --git a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java index 56b185c6fa53..a7d0e33cc23c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java @@ -43,9 +43,9 @@ public class SchemesManagerFactoryImpl extends SchemesManagerFactory implements if (baseDirPath != null) { - SchemesManagerImpl manager = new SchemesManagerImpl(fileSpec, processor, roamingType, - ((ApplicationImpl)ApplicationManager.getApplication()).getStateStore().getStateStorageManager().getStreamProviders(roamingType), - new File(baseDirPath)); + StreamProvider[] providers = + ((ApplicationImpl)ApplicationManager.getApplication()).getStateStore().getStateStorageManager().getStreamProviders(roamingType); + SchemesManagerImpl manager = new SchemesManagerImpl(fileSpec, processor, roamingType, providers, new File(baseDirPath)); myRegisteredManagers.add(manager); return manager; } diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java index 140bef2c6caf..36b30d025a66 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsTree.java @@ -431,13 +431,12 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl } protected SimpleNode[] buildChildren() { - ArrayList result = new ArrayList(); - for (int i = 0; i < myGroups.size(); i++) { - ConfigurableGroup eachGroup = myGroups.get(i); + List result = new ArrayList(); + for (ConfigurableGroup eachGroup : myGroups) { result.addAll(buildGroup(eachGroup)); } - return result.toArray(new SimpleNode[result.size()]); + return result.isEmpty() ? NO_CHILDREN : result.toArray(new SimpleNode[result.size()]); } private List buildGroup(final ConfigurableGroup eachGroup) { @@ -458,7 +457,7 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl } } - private boolean isInvisibleNode(final Configurable child) { + private static boolean isInvisibleNode(final Configurable child) { return child instanceof SearchableConfigurable.Parent && !((SearchableConfigurable.Parent)child).isVisible(); } @@ -495,8 +494,8 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl } } + private static final EditorNode[] EMPTY_EN_ARRAY = new EditorNode[0]; class EditorNode extends Base { - Configurable myConfigurable; ConfigurableGroup myGroup; @@ -510,7 +509,7 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl protected EditorNode[] buildChildren() { List list = OptionsTree.this.buildChildren(myConfigurable, this, null); - return list.toArray(new EditorNode[list.size()]); + return list.isEmpty() ? EMPTY_EN_ARRAY : list.toArray(new EditorNode[list.size()]); } @Override diff --git a/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/FilteringTreeBuilderTest.java b/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/FilteringTreeBuilderTest.java index 2f085e64d422..6f5f278349f6 100644 --- a/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/FilteringTreeBuilderTest.java +++ b/platform/platform-impl/testSrc/com/intellij/ide/util/treeView/FilteringTreeBuilderTest.java @@ -198,7 +198,7 @@ public class FilteringTreeBuilderTest extends BaseTreeTestCase { } protected SimpleNode[] buildChildren() { - return myKids.values().toArray(new Node[myKids.size()]); + return myKids.isEmpty() ? NO_CHILDREN : myKids.values().toArray(new Node[myKids.size()]); } @Override diff --git a/platform/platform-resources-en/src/messages/RefactoringBundle.properties b/platform/platform-resources-en/src/messages/RefactoringBundle.properties index fb632252f72a..5f0430f30a15 100644 --- a/platform/platform-resources-en/src/messages/RefactoringBundle.properties +++ b/platform/platform-resources-en/src/messages/RefactoringBundle.properties @@ -100,6 +100,7 @@ superinterface.name=&Super interface name: delegate.members=Delegate members generate.getter.for.delegated.component=Generate &getter for delegated component package.for.new.superclass=&Package for new superclass: +package.for.original.class=&Package for original class: ExtractSuperClass.superclass=Superclass members.to.form.superclass=Members to form superclass no.superclass.name.specified=No superclass name specified diff --git a/platform/util/src/com/intellij/util/containers/CoModifiableList.java b/platform/util/src/com/intellij/util/containers/CoModifiableList.java deleted file mode 100644 index 57d57c41b761..000000000000 --- a/platform/util/src/com/intellij/util/containers/CoModifiableList.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2000-2009 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.containers; - -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class CoModifiableList extends AbstractList { - private ArrayList myAfterIteratingElements = null; - private final List myElements; - - public CoModifiableList(List elements) { - myElements = elements; - } - - public synchronized boolean add(T rangeMarker) { - if (myAfterIteratingElements != null) myAfterIteratingElements.add(rangeMarker); - else myElements.add(rangeMarker); - return true; - } - - public synchronized T remove(int index) { - return myElements.remove(index); - } - - public T get(int index) { - return myElements.get(index); - } - - public int size() { - return myElements.size(); - } - - public void forEach(InnerIterator innerIterator) { - if (myAfterIteratingElements != null) { - throw new RuntimeException("Nested iterations aren't supported"); - } - try { - myAfterIteratingElements = new ArrayList(); - for (Iterator iterator = myElements.iterator(); iterator.hasNext();) { - T rangeMarker = iterator.next(); - if (rangeMarker == null) continue; - innerIterator.process(rangeMarker, iterator); - } - } finally { - synchronized(this) { - for (Iterator iterator = myAfterIteratingElements.iterator(); iterator.hasNext();) { - T rangeMarker = iterator.next(); - myElements.add(rangeMarker); - } - myAfterIteratingElements = null; - } - } - } - - public interface InnerIterator { - void process(T rangeMarker, Iterator iterator); - } -} diff --git a/platform/util/src/com/intellij/util/io/fs/IoFile.java b/platform/util/src/com/intellij/util/io/fs/IoFile.java index 4dce8f09f174..82edf1fde9e4 100644 --- a/platform/util/src/com/intellij/util/io/fs/IoFile.java +++ b/platform/util/src/com/intellij/util/io/fs/IoFile.java @@ -24,7 +24,7 @@ import java.io.*; class IoFile implements IFile { private final File myFile; - private final IFile[] EMPTY_ARRAY = new IFile[0]; + private static final IFile[] EMPTY_ARRAY = new IFile[0]; public IoFile(@NotNull final File file) { myFile = file; diff --git a/platform/util/testSrc/com/intellij/util/containers/CoModifiableListTest.java b/platform/util/testSrc/com/intellij/util/containers/CoModifiableListTest.java deleted file mode 100644 index 8a02d02e4fc6..000000000000 --- a/platform/util/testSrc/com/intellij/util/containers/CoModifiableListTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2000-2009 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.containers; - -import com.intellij.util.Assertion; -import com.intellij.openapi.util.text.StringUtil; - -import java.util.ArrayList; -import java.util.Iterator; - -public class CoModifiableListTest extends junit.framework.TestCase { - private final Assertion CHECK = new Assertion(); - private final ArrayList mySourceList = new ArrayList(); - private final com.intellij.util.containers.CoModifiableList myList = new com.intellij.util.containers.CoModifiableList(mySourceList); - - public void testAdd() { - myList.add("1"); - myList.add("2"); - checkElements(new Object[]{"1", "2"}); - } - - - public void testInnerIterator() { - mySourceList.add("a1"); - mySourceList.add("b2"); - mySourceList.add("a2"); - myList.forEach(new CoModifiableList.InnerIterator() { - public void process(Object object, Iterator iterator) { - if (StringUtil.startsWithChar(object.toString(), 'b')) iterator.remove(); - } - }); - checkElements(new Object[]{"a1", "a2"}); - } - - public void testAddDuringItarating() { - myList.add("1"); - myList.add("2"); - final int[] count = new int[] { 0 }; - myList.forEach(new CoModifiableList.InnerIterator() { - public void process(Object object, Iterator iterator) { - count[0]++; - myList.add("new" + object); - } - }); - junit.framework.Assert.assertEquals(2, count[0]); - checkElements(new Object[]{"1", "2", "new1", "new2"}); - } - - public void testRemoveDuringItarating() { - myList.add("1"); - myList.add("2"); - final int[] count = new int[] { 0 }; - myList.forEach(new CoModifiableList.InnerIterator() { - public void process(Object object, Iterator iterator) { - count[0]++; - if (object.equals("2")) { - iterator.remove(); - } - } - }); - junit.framework.Assert.assertEquals(2, count[0]); - checkElements(new Object[]{"1"}); - } - - private void checkElements(Object[] expected) { - CHECK.compareAll(expected, mySourceList); - CHECK.compareAll(expected, myList); - } -} diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManager.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManager.java index fe24aa50098d..9b81c080effb 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManager.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseModuleManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2010 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,33 @@ package org.jetbrains.idea.eclipse.config; +import com.intellij.openapi.components.*; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleServiceManager; +import com.intellij.openapi.roots.impl.storage.ClasspathStorage; +import org.jdom.Element; +import org.jetbrains.annotations.NonNls; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -public class EclipseModuleManager { +@State( + name = "EclipseModuleManager", + storages = { + @Storage( + id = "default", + file = "$MODULE_FILE$" + ) + } +) +public class EclipseModuleManager implements PersistentStateComponent{ + @NonNls private static final String VALUE_ATTR = "value"; + @NonNls private static final String VARELEMENT = "varelement"; + @NonNls private static final String VAR_ATTRIBUTE = "var"; + @NonNls private static final String CONELEMENT = "conelement"; + @NonNls private static final String FORCED_JDK = "forced_jdk"; private CachedXmlDocumentSet myDocumentSet; private final Map myEclipseVariablePaths = new HashMap(); private final Set myEclipseUrls = new HashSet(); @@ -32,8 +50,12 @@ public class EclipseModuleManager { private boolean myForceConfigureJDK = false; private static final String SRC_PREFIX = "src:"; private static final String SRC_LINK_PREFIX = "linksrc:"; + private final Module myModule; + @NonNls private static final String LIBELEMENT = "libelement"; - public EclipseModuleManager(Module module) {} + public EclipseModuleManager(Module module) { + myModule = module; + } public static EclipseModuleManager getInstance(Module module) { return ModuleServiceManager.getService(module, EclipseModuleManager.class); @@ -94,4 +116,51 @@ public class EclipseModuleManager { public boolean isEclipseLibUrl(String url) { return myEclipseUrls.contains(url); } + + public Element getState() { + if (ClasspathStorage.getStorageType(myModule) != EclipseClasspathStorageProvider.ID) { + if (!myEclipseUrls.isEmpty() || !myEclipseVariablePaths.isEmpty() || myForceConfigureJDK || !myUnknownCons.isEmpty()) { + Element root = new Element("EclipseModuleSettings"); + for (String eclipseUrl : myEclipseUrls) { + final Element libElement = new Element(LIBELEMENT); + libElement.setAttribute(VALUE_ATTR, eclipseUrl); + root.addContent(libElement); + } + for (String var : myEclipseVariablePaths.keySet()) { + Element varElement = new Element(VARELEMENT); + varElement.setAttribute(VAR_ATTRIBUTE, var); + varElement.setAttribute(VALUE_ATTR, myEclipseVariablePaths.get(var)); + root.addContent(varElement); + } + for (String unknownCon : myUnknownCons) { + Element conElement = new Element(CONELEMENT); + conElement.setAttribute(VALUE_ATTR, unknownCon); + root.addContent(conElement); + } + + if (myForceConfigureJDK) { + root.setAttribute(FORCED_JDK, String.valueOf(true)); + } + return root; + } + } + return null; + } + + public void loadState(Element state) { + for (Object o : state.getChildren(LIBELEMENT)) { + myEclipseUrls.add(((Element)o).getAttributeValue(VALUE_ATTR)); + } + + for (Object o : state.getChildren(VARELEMENT)) { + myEclipseVariablePaths.put(((Element)o).getAttributeValue(VAR_ATTRIBUTE), ((Element)o).getAttributeValue(VALUE_ATTR)); + } + + for (Object o : state.getChildren(CONELEMENT)) { + myUnknownCons.add(((Element)o).getAttributeValue(VALUE_ATTR)); + } + + final String forcedJdk = state.getAttributeValue(FORCED_JDK); + myForceConfigureJDK = forcedJdk != null && Boolean.parseBoolean(forcedJdk); + } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java index ce8e3aeabff0..a2d81894faf1 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgExecutableValidator.java @@ -24,16 +24,16 @@ import java.lang.reflect.InvocationTargetException; public class HgExecutableValidator { private static final Logger LOG = Logger.getInstance(HgExecutableValidator.class.getName()); - private final Project project; + private final Project myProject; private boolean myValidHgExecutable; public HgExecutableValidator(Project project) { - this.project = project; + this.myProject = project; } public boolean check(final HgGlobalSettings globalSettings) { final HgVersionCommand command = new HgVersionCommand(); - if (command.isValid(globalSettings.getHgExecutable())) { + if (command.isValid(HgVcs.getInstance(myProject).getHgExecutable())) { return true; } @@ -48,7 +48,7 @@ public class HgExecutableValidator { String previousHgPath = globalSettings.getHgExecutable(); HgSetExecutableDialog dialog; do { - dialog = new HgSetExecutableDialog(project); + dialog = new HgSetExecutableDialog(myProject); dialog.setBadHgPath(previousHgPath); dialog.show(); myValidHgExecutable = dialog.isOK() && command.isValid(dialog.getNewHgPath()); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgUtil.java index b067f8321dba..21ed4617406e 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgUtil.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgUtil.java @@ -90,7 +90,7 @@ public abstract class HgUtil { } /** - * Runs the given task as a write action in the event dispatching thread. + * Runs the given task as a write action in the event dispatching thread and waits for its completion. */ public static void runWriteActionAndWait(@NotNull final Runnable runnable) throws InvocationTargetException, InterruptedException { GuiUtils.runOrInvokeAndWait(new Runnable() { @@ -100,6 +100,17 @@ public abstract class HgUtil { }); } + /** + * Schedules the given task to be run as a write action in the event dispatching thread. + */ + public static void runWriteActionLater(@NotNull final Runnable runnable) { + ApplicationManager.getApplication().invokeLater(new Runnable() { + public void run() { + ApplicationManager.getApplication().runWriteAction(runnable); + } + }); + } + /** * Returns a temporary python file that will be deleted on exit. * diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java index ca5031690c9b..4d6c5f29180e 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgVcs.java @@ -17,6 +17,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileEditor.FileEditorManagerAdapter; import com.intellij.openapi.fileEditor.FileEditorManagerEvent; import com.intellij.openapi.fileEditor.FileEditorManagerListener; +import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; @@ -38,7 +39,6 @@ import com.intellij.openapi.vfs.VirtualFileListener; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.openapi.wm.StatusBar; import com.intellij.openapi.wm.WindowManager; -import com.intellij.util.messages.MessageBus; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.messages.Topic; import org.zmlx.hg4idea.provider.*; @@ -75,6 +75,8 @@ public class HgVcs extends AbstractVcs { public static final String NOTIFICATION_GROUP_ID = "Mercurial"; public static final String HG_EXECUTABLE_FILE_NAME = (SystemInfo.isWindows ? "hg.exe" : "hg"); + private static final String ORIG_FILE_PATTERN = "*.orig"; + private final HgChangeProvider changeProvider; private final HgProjectConfigurable configurable; private final HgRollbackEnvironment rollbackEnvironment; @@ -225,17 +227,18 @@ public class HgVcs extends AbstractVcs { @Override public void activate() { + // validate hg executable if (ApplicationManager.getApplication().isUnitTestMode()) { started = true; } else { HgExecutableValidator validator = new HgExecutableValidator(myProject); started = validator.check(globalSettings); } - if (!started) { return; } + // status bar StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject); if (statusBar != null) { statusBar.addWidget(hgCurrentBranchStatus, myProject); @@ -243,30 +246,21 @@ public class HgVcs extends AbstractVcs { statusBar.addWidget(outgoingChangesStatus, myProject); } - final HgIncomingStatusUpdater incomingUpdater = - new HgIncomingStatusUpdater(incomingChangesStatus, projectSettings); - - final HgOutgoingStatusUpdater outgoingUpdater = - new HgOutgoingStatusUpdater(outgoingChangesStatus, projectSettings); - + // updaters and listeners + final HgIncomingStatusUpdater incomingUpdater = new HgIncomingStatusUpdater(incomingChangesStatus, projectSettings); + final HgOutgoingStatusUpdater outgoingUpdater = new HgOutgoingStatusUpdater(outgoingChangesStatus, projectSettings); changesUpdaterScheduledFuture = JobScheduler.getScheduler().scheduleWithFixedDelay( new Runnable() { public void run() { incomingUpdater.update(myProject); outgoingUpdater.update(myProject); } - }, 0, globalSettings.getIncomingCheckIntervalSeconds(), TimeUnit.SECONDS); - - MessageBus messageBus = myProject.getMessageBus(); - messageBusConnection = messageBus.connect(); + }, 0, HgGlobalSettings.getIncomingCheckIntervalSeconds(), TimeUnit.SECONDS); + messageBusConnection = myProject.getMessageBus().connect(); messageBusConnection.subscribe(INCOMING_TOPIC, incomingUpdater); messageBusConnection.subscribe(OUTGOING_TOPIC, outgoingUpdater); - - messageBusConnection.subscribe( - BRANCH_TOPIC, new HgCurrentBranchStatusUpdater(hgCurrentBranchStatus) - ); - + messageBusConnection.subscribe(BRANCH_TOPIC, new HgCurrentBranchStatusUpdater(hgCurrentBranchStatus)); messageBusConnection.subscribe( FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() { @@ -281,8 +275,18 @@ public class HgVcs extends AbstractVcs { ); myVFSListener = new HgVFSListener(myProject, this); - VirtualFileManager.getInstance().addVirtualFileListener(myDirStateChangeListener); + + // ignore temporary files + final String ignoredPattern = FileTypeManager.getInstance().getIgnoredFilesList(); + if (!ignoredPattern.contains(ORIG_FILE_PATTERN)) { + final String newPattern = ignoredPattern + (ignoredPattern.endsWith(";") ? "" : ";") + ORIG_FILE_PATTERN; + HgUtil.runWriteActionLater(new Runnable() { + public void run() { + FileTypeManager.getInstance().setIgnoredFilesList(newPattern); + } + }); + } } @Override diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java index e6935f2d086e..8f21511f71d5 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgConfigurationProjectPanel.java @@ -12,16 +12,9 @@ // limitations under the License. package org.zmlx.hg4idea.ui; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import org.zmlx.hg4idea.HgProjectSettings; -import javax.swing.BorderFactory; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.JPanel; -import java.awt.Insets; +import javax.swing.*; public class HgConfigurationProjectPanel { @@ -54,49 +47,4 @@ public class HgConfigurationProjectPanel { return panel; } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - panel = new JPanel(); - panel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); - final Spacer spacer1 = new Spacer(); - panel.add(spacer1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); - panel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Changesets")); - checkIncomingCbx = new JCheckBox(); - checkIncomingCbx.setSelected(true); - checkIncomingCbx.setText("Check for incoming changesets"); - checkIncomingCbx.setMnemonic('I'); - checkIncomingCbx.setDisplayedMnemonicIndex(10); - panel1.add(checkIncomingCbx, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final Spacer spacer2 = new Spacer(); - panel1.add(spacer2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - checkOutgoingCbx = new JCheckBox(); - checkOutgoingCbx.setSelected(true); - checkOutgoingCbx.setText("Check for outgoing changesets"); - checkOutgoingCbx.setMnemonic('O'); - checkOutgoingCbx.setDisplayedMnemonicIndex(10); - panel1.add(checkOutgoingCbx, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return panel; - } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgGlobalStatusDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgGlobalStatusDialog.java index 860331cf48f2..fef6c9c57518 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgGlobalStatusDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgGlobalStatusDialog.java @@ -14,13 +14,9 @@ package org.zmlx.hg4idea.ui; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.ui.ScrollPaneFactory; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; import org.apache.commons.lang.StringUtils; import javax.swing.*; -import java.awt.*; public class HgGlobalStatusDialog extends DialogWrapper { private JPanel contentPanel; @@ -46,34 +42,4 @@ public class HgGlobalStatusDialog extends DialogWrapper { return contentPanel; } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - contentPanel = new JPanel(); - contentPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); - final JScrollPane scrollPane1 = ScrollPaneFactory.createScrollPane(); - contentPanel.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, new Dimension(300, 350), null, null, 0, false)); - outputTextArea = new JTextArea(); - outputTextArea.setEditable(false); - scrollPane1.setViewportView(outputTextArea); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return contentPanel; - } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java index 2c04d3b90051..8048638ef270 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java @@ -15,24 +15,14 @@ package org.zmlx.hg4idea.ui; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import org.apache.commons.lang.StringUtils; import org.zmlx.hg4idea.command.HgShowConfigCommand; -import javax.swing.BorderFactory; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.Dimension; -import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Collection; @@ -127,61 +117,4 @@ public class HgPushDialog extends DialogWrapper { && !(revisionCbx.isSelected() && StringUtils.isBlank(revisionTxt.getText())); } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - contentPanel = new JPanel(); - contentPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); - final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1)); - contentPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - final Spacer spacer1 = new Spacer(); - panel1.add(spacer1, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - final JLabel label1 = new JLabel(); - label1.setText("Destination Repository URL:"); - label1.setDisplayedMnemonic('D'); - label1.setDisplayedMnemonicIndex(0); - panel1.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - repositoryTxt = new JTextField(); - panel1.add(repositoryTxt, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JPanel panel2 = new JPanel(); - panel2.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel1.add(panel2, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(-1, 100), null, null, 0, false)); - panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Options")); - revisionCbx = new JCheckBox(); - revisionCbx.setText("Revision"); - revisionCbx.setMnemonic('R'); - revisionCbx.setDisplayedMnemonicIndex(0); - panel2.add(revisionCbx, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - revisionTxt = new JTextField(); - revisionTxt.setEnabled(false); - revisionTxt.setText("tip"); - panel2.add(revisionTxt, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - final Spacer spacer2 = new Spacer(); - panel2.add(spacer2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - final Spacer spacer3 = new Spacer(); - panel2.add(spacer3, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - hgRepositorySelectorComponent = new HgRepositorySelectorComponent(); - panel1.add(hgRepositorySelectorComponent.$$$getRootComponent$$$(), new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - label1.setLabelFor(repositoryTxt); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return contentPanel; - } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRunConflictResolverDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRunConflictResolverDialog.java index d3748275ed22..7cb564cd49f8 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRunConflictResolverDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRunConflictResolverDialog.java @@ -15,21 +15,11 @@ package org.zmlx.hg4idea.ui; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.ui.components.JBList; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import org.zmlx.hg4idea.HgFile; import org.zmlx.hg4idea.command.HgResolveCommand; import org.zmlx.hg4idea.command.HgResolveStatusEnum; -import javax.swing.BorderFactory; -import javax.swing.DefaultListModel; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JPanel; -import java.awt.Dimension; -import java.awt.Insets; +import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Collection; @@ -85,39 +75,4 @@ public class HgRunConflictResolverDialog extends DialogWrapper { conflictsList.setModel(model); } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - mainPanel = new JPanel(); - mainPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); - repositorySelector = new HgRepositorySelectorComponent(); - mainPanel.add(repositorySelector.$$$getRootComponent$$$(), new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); - mainPanel.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - panel1.setBorder(BorderFactory.createTitledBorder("Files with conflicts:")); - conflictsList = new JBList(); - panel1.add(conflictsList, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 150), null, 0, false)); - final Spacer spacer1 = new Spacer(); - mainPanel.add(spacer1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return mainPanel; - } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSetExecutableDialog.form b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSetExecutableDialog.form index 94b8fcd2f4de..cf6ef6d49a4d 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSetExecutableDialog.form +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSetExecutableDialog.form @@ -10,7 +10,7 @@ - + diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSwitchDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSwitchDialog.java index a0fab79b3cc2..ad68a464725d 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSwitchDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgSwitchDialog.java @@ -15,25 +15,12 @@ package org.zmlx.hg4idea.ui; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import org.zmlx.hg4idea.command.HgTagBranch; import org.zmlx.hg4idea.command.HgTagBranchCommand; -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.Dimension; -import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Collection; @@ -145,77 +132,4 @@ public class HgSwitchDialog extends DialogWrapper { return contentPanel; } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - contentPanel = new JPanel(); - contentPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1)); - final Spacer spacer1 = new Spacer(); - contentPanel.add(spacer1, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - final Spacer spacer2 = new Spacer(); - contentPanel.add(spacer2, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - cleanCbx = new JCheckBox(); - cleanCbx.setText("Overwrite locally modified files (no backup)"); - cleanCbx.setMnemonic('O'); - cleanCbx.setDisplayedMnemonicIndex(0); - contentPanel.add(cleanCbx, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1)); - contentPanel.add(panel1, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - panel1.setBorder(BorderFactory.createTitledBorder("Switch to:")); - branchOption = new JRadioButton(); - branchOption.setSelected(true); - branchOption.setText("Branch"); - branchOption.setMnemonic('B'); - branchOption.setDisplayedMnemonicIndex(0); - panel1.add(branchOption, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - branchSelector = new JComboBox(); - branchSelector.setEnabled(true); - final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); - branchSelector.setModel(defaultComboBoxModel1); - panel1.add(branchSelector, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - revisionOption = new JRadioButton(); - revisionOption.setSelected(false); - revisionOption.setText("Revision"); - revisionOption.setMnemonic('R'); - revisionOption.setDisplayedMnemonicIndex(0); - panel1.add(revisionOption, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - revisionTxt = new JTextField(); - revisionTxt.setEnabled(false); - revisionTxt.setText(""); - panel1.add(revisionTxt, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - tagOption = new JRadioButton(); - tagOption.setText("Tag"); - tagOption.setMnemonic('T'); - tagOption.setDisplayedMnemonicIndex(0); - panel1.add(tagOption, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - tagSelector = new JComboBox(); - panel1.add(tagSelector, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - hgRepositorySelectorComponent = new HgRepositorySelectorComponent(); - contentPanel.add(hgRepositorySelectorComponent.$$$getRootComponent$$$(), new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - ButtonGroup buttonGroup; - buttonGroup = new ButtonGroup(); - buttonGroup.add(revisionOption); - buttonGroup.add(branchOption); - buttonGroup.add(tagOption); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return contentPanel; - } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgTagDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgTagDialog.java index 6b2a31518fe9..7d3bd9899aa8 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgTagDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgTagDialog.java @@ -15,19 +15,11 @@ package org.zmlx.hg4idea.ui; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import org.apache.commons.lang.StringUtils; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; +import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.Dimension; -import java.awt.Insets; import java.util.Collection; public class HgTagDialog extends DialogWrapper { @@ -84,43 +76,4 @@ public class HgTagDialog extends DialogWrapper { return StringUtils.isNotBlank(tagTxt.getText()); } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - contentPanel = new JPanel(); - contentPanel.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); - final Spacer spacer1 = new Spacer(); - contentPanel.add(spacer1, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - hgRepositorySelectorComponent = new HgRepositorySelectorComponent(); - contentPanel.add(hgRepositorySelectorComponent.$$$getRootComponent$$$(), new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); - contentPanel.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - final JLabel label1 = new JLabel(); - label1.setText("Tag name:"); - panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final Spacer spacer2 = new Spacer(); - panel1.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - tagTxt = new JTextField(); - panel1.add(tagTxt, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return contentPanel; - } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java index f997a982b347..168954e1cddd 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java @@ -12,13 +12,9 @@ // limitations under the License. package org.zmlx.hg4idea.ui; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.Spacer; import org.zmlx.hg4idea.provider.update.HgUpdater; import javax.swing.*; -import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -67,57 +63,4 @@ public class HgUpdateDialog { commitAfterMergeCheckBox.setSelected(updateConfiguration.shouldCommitAfterMerge()); } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - contentPane = new JPanel(); - contentPane.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1)); - pullCheckBox = new JCheckBox(); - pullCheckBox.setText("pull"); - pullCheckBox.setMnemonic('P'); - pullCheckBox.setDisplayedMnemonicIndex(0); - pullCheckBox.setToolTipText("pull from the default remote repository"); - contentPane.add(pullCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final Spacer spacer1 = new Spacer(); - contentPane.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - updateCheckBox = new JCheckBox(); - updateCheckBox.setText("update"); - updateCheckBox.setMnemonic('U'); - updateCheckBox.setDisplayedMnemonicIndex(0); - updateCheckBox.setToolTipText("update to the head of the current branch"); - contentPane.add(updateCheckBox, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - mergeCheckBox = new JCheckBox(); - mergeCheckBox.setText("merge"); - mergeCheckBox.setMnemonic('M'); - mergeCheckBox.setDisplayedMnemonicIndex(0); - mergeCheckBox.setToolTipText("merge if pulling resulted in extra heads"); - contentPane.add(mergeCheckBox, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - commitAfterMergeCheckBox = new JCheckBox(); - commitAfterMergeCheckBox.setText("commit after merge without conflicts"); - commitAfterMergeCheckBox.setMnemonic('C'); - commitAfterMergeCheckBox.setDisplayedMnemonicIndex(0); - commitAfterMergeCheckBox.setToolTipText("commit automatically after the merge"); - contentPane.add(commitAfterMergeCheckBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final Spacer spacer2 = new Spacer(); - contentPane.add(spacer2, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return contentPane; - } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUsernamePasswordDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUsernamePasswordDialog.java index 410b494be1bc..c11c028ed606 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUsernamePasswordDialog.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUsernamePasswordDialog.java @@ -14,17 +14,8 @@ package org.zmlx.hg4idea.ui; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.uiDesigner.core.GridLayoutManager; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.Spacer; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JPasswordField; -import javax.swing.JTextField; -import javax.swing.JLabel; -import java.awt.Insets; -import java.awt.Dimension; +import javax.swing.*; public class HgUsernamePasswordDialog extends DialogWrapper { private JPanel basePanel; @@ -53,48 +44,4 @@ public class HgUsernamePasswordDialog extends DialogWrapper { return basePanel; } - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - basePanel = new JPanel(); - basePanel.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1)); - final JLabel label1 = new JLabel(); - label1.setText("Username"); - label1.setDisplayedMnemonic('U'); - label1.setDisplayedMnemonicIndex(0); - basePanel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - usernameTxt = new JTextField(); - basePanel.add(usernameTxt, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - final JLabel label2 = new JLabel(); - label2.setText("Password"); - label2.setDisplayedMnemonic('P'); - label2.setDisplayedMnemonicIndex(0); - basePanel.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final Spacer spacer1 = new Spacer(); - basePanel.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - passwordTxt = new JPasswordField(); - passwordTxt.setText(""); - basePanel.add(passwordTxt, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - label1.setLabelFor(usernameTxt); - label2.setLabelFor(passwordTxt); - } - - /** - * @noinspection ALL - */ - public JComponent $$$getRootComponent$$$() { - return basePanel; - } } 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 dfe9baaa737d..a27a2cc70cdf 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -361,7 +361,7 @@ public class JUnitConfigurable extends SettingsEditor { private void setPackage(final PsiPackage aPackage) { if (aPackage == null) return; - ((LabeledComponent)getTestLocation(JUnitConfigurationModel.ALL_IN_PACKAGE).getComponent()).setText(aPackage.getQualifiedName()); + ((LabeledComponent)getTestLocation(JUnitConfigurationModel.ALL_IN_PACKAGE)).getComponent().setText(aPackage.getQualifiedName()); } @NotNull diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java index a271935d4d9a..a8fa5265c569 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java @@ -55,7 +55,7 @@ public class XmlTagValueImpl implements XmlTagValue{ for (final XmlTagChild element : myElements) { if (element instanceof XmlText) textElementsList.add((XmlText)element); } - return myTextElements = ContainerUtil.toArray(textElementsList, new XmlText[textElementsList.size()]); + return myTextElements = textElementsList.isEmpty() ? XmlText.EMPTY_ARRAY : ContainerUtil.toArray(textElementsList, new XmlText[textElementsList.size()]); } @NotNull diff --git a/xml/openapi/src/com/intellij/psi/xml/XmlText.java b/xml/openapi/src/com/intellij/psi/xml/XmlText.java index 608daedbd34a..4c9a84d38b1a 100644 --- a/xml/openapi/src/com/intellij/psi/xml/XmlText.java +++ b/xml/openapi/src/com/intellij/psi/xml/XmlText.java @@ -36,4 +36,5 @@ public interface XmlText extends XmlTagChild { @Nullable XmlText split(int displayIndex); + XmlText[] EMPTY_ARRAY = new XmlText[0]; }