diff --git a/community-resources/src/add_plugin_modulewizard.png b/community-resources/src/add_plugin_modulewizard.png
index df657e54941e..c801584be711 100644
Binary files a/community-resources/src/add_plugin_modulewizard.png and b/community-resources/src/add_plugin_modulewizard.png differ
diff --git a/community-resources/src/addmodulewizard.png b/community-resources/src/addmodulewizard.png
index 6fbdca509757..1bed8222d022 100644
Binary files a/community-resources/src/addmodulewizard.png and b/community-resources/src/addmodulewizard.png differ
diff --git a/community-resources/src/newprojectwizard.png b/community-resources/src/newprojectwizard.png
index 45dac3fa5f95..de8c2332ce87 100644
Binary files a/community-resources/src/newprojectwizard.png and b/community-resources/src/newprojectwizard.png differ
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
index a299bba3bb1c..9586c74ecb05 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
@@ -77,6 +77,7 @@ import com.intellij.packaging.artifacts.ArtifactManager;
import com.intellij.packaging.impl.artifacts.ArtifactImpl;
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
+import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;
import com.intellij.pom.Navigatable;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiDocumentManager;
@@ -2474,6 +2475,7 @@ public class CompileDriver {
}
}
}
+ affectedOutputPaths.addAll(ArtifactCompilerUtil.getArtifactOutputsContainingSourceFiles(myProject));
if (!affectedOutputPaths.isEmpty()) {
final StringBuilder paths = new StringBuilder();
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
index f512c68e7a0b..6915ae2e3379 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompilerUtil.java
@@ -18,14 +18,32 @@ package com.intellij.packaging.impl.compiler;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompilerMessageCategory;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.JarFileSystem;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.packaging.artifacts.Artifact;
+import com.intellij.packaging.artifacts.ArtifactManager;
+import com.intellij.packaging.elements.ComplexPackagingElement;
+import com.intellij.packaging.elements.PackagingElement;
+import com.intellij.packaging.elements.PackagingElementResolvingContext;
+import com.intellij.packaging.impl.artifacts.ArtifactUtil;
+import com.intellij.packaging.impl.artifacts.PackagingElementPath;
+import com.intellij.packaging.impl.artifacts.PackagingElementProcessor;
+import com.intellij.packaging.impl.elements.ArtifactPackagingElement;
+import com.intellij.packaging.impl.elements.FileOrDirectoryCopyPackagingElement;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -65,4 +83,40 @@ public class ArtifactCompilerUtil {
String fullPath = jarEntry.getPath();
return new File(FileUtil.toSystemDependentName(fullPath.substring(fullPath.indexOf(JarFileSystem.JAR_SEPARATOR))));
}
+
+
+ @NotNull
+ public static Set getArtifactOutputsContainingSourceFiles(final @NotNull Project project) {
+ final List allOutputs = new ArrayList();
+ for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
+ ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);
+ }
+
+ final Set affectedOutputPaths = new HashSet();
+ final PackagingElementResolvingContext context = ArtifactManager.getInstance(project).getResolvingContext();
+ for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
+ ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor>() {
+ @Override
+ public boolean shouldProcessSubstitution(ComplexPackagingElement> element) {
+ return !(element instanceof ArtifactPackagingElement);
+ }
+
+ @Override
+ public boolean process(@NotNull PackagingElement> element, @NotNull PackagingElementPath path) {
+ if (element instanceof FileOrDirectoryCopyPackagingElement>) {
+ final VirtualFile file = ((FileOrDirectoryCopyPackagingElement)element).findFile();
+ if (file != null) {
+ for (VirtualFile output : allOutputs) {
+ if (VfsUtilCore.isAncestor(output, file, false)) {
+ affectedOutputPaths.add(output);
+ }
+ }
+ }
+ }
+ return true;
+ }
+ }, context, true);
+ }
+ return affectedOutputPaths;
+ }
}
diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorImpl.java b/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorImpl.java
index 78af4b89e87b..de8bbb9f157a 100644
--- a/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorImpl.java
+++ b/java/idea-ui/src/com/intellij/facet/impl/ui/FacetEditorImpl.java
@@ -28,6 +28,7 @@ import com.intellij.openapi.options.UnnamedConfigurable;
import com.intellij.openapi.options.UnnamedConfigurableGroup;
import com.intellij.openapi.util.Disposer;
import com.intellij.ui.TabbedPaneWrapper;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -77,7 +78,11 @@ public class FacetEditorImpl extends UnnamedConfigurableGroup implements Unnamed
if (myEditorTabs.length > 1) {
final TabbedPaneWrapper tabbedPane = new TabbedPaneWrapper(myDisposable);
for (FacetEditorTab editorTab : myEditorTabs) {
- tabbedPane.addTab(editorTab.getDisplayName(), editorTab.getIcon(), editorTab.createComponent(), null);
+ JComponent c = editorTab.createComponent();
+ if (c != null) {
+ UIUtil.addInsets(c, UIUtil.PANEL_SMALL_INSETS);
+ }
+ tabbedPane.addTab(editorTab.getDisplayName(), editorTab.getIcon(), c, null);
}
tabbedPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameStep.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameStep.java
index cd856b7c3ab4..c271ba377f4d 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameStep.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectNameStep.java
@@ -152,7 +152,7 @@ public class ProjectNameStep extends ModuleWizardStep {
}
final File file = new File(projectFileDirectory);
- if (!file.canWrite()) {
+ if (file.exists() && !file.canWrite()) {
throw new ConfigurationException(String.format("Directory '%s' is not writable!\nPlease choose another project location.", projectFileDirectory));
}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/AnnotationsEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/AnnotationsEditor.java
index 9b4f8c0f7016..082ecbaef263 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/AnnotationsEditor.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/AnnotationsEditor.java
@@ -20,15 +20,16 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.roots.AnnotationOrderRootType;
-import com.intellij.openapi.ui.PanelWithText;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ColoredTableCellRenderer;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.TableUtil;
+import com.intellij.ui.components.JBLabel;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ui.ItemRemovable;
import com.intellij.util.ui.Table;
+import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import javax.swing.border.Border;
@@ -81,8 +82,7 @@ public class AnnotationsEditor extends ModuleElementsEditor {
}
public JComponent createComponentImpl() {
- final JPanel mainPanel = new JPanel(new BorderLayout());
- mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
+ final JPanel mainPanel = new JPanel(new BorderLayout(5, 10));
mainPanel.setPreferredSize(new Dimension(-1, 200));
final DefaultTableModel tableModel = createModel();
myTable = new Table(tableModel);
@@ -109,14 +109,12 @@ public class AnnotationsEditor extends ModuleElementsEditor {
});
final JPanel panel = new JPanel(new GridBagLayout());
- panel.add(myAddPathButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 0), 0, 0));
- panel.add(myRemoveButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
+ panel.add(myAddPathButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ panel.add(myRemoveButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0));
mainPanel.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
mainPanel.add(panel, BorderLayout.EAST);
- final PanelWithText panelWithText = new PanelWithText(ProjectBundle.message("project.roots.external.annotations.description"));
- panelWithText.setBorder(null);
- mainPanel.add(panelWithText, BorderLayout.NORTH);
+ mainPanel.add(new JBLabel(ProjectBundle.message("project.roots.external.annotations.description"), UIUtil.ComponentStyle.SMALL, UIUtil.FontColor.BRIGHTER), BorderLayout.NORTH);
myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java
index 72e35ed64766..9233ad1d8c88 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ConfigurationErrorsComponent.java
@@ -135,6 +135,7 @@ public class ConfigurationErrorsComponent extends JPanel implements Disposable,
add(myCurrentView.self(), BorderLayout.CENTER);
myCurrentView.updateView();
+ UIUtil.adjustWindowToMinimumSize(SwingUtilities.getWindowAncestor(this));
revalidate();
repaint();
}
@@ -282,8 +283,8 @@ public class ConfigurationErrorsComponent extends JPanel implements Disposable,
if (window != null) {
final Dimension d = window.getSize();
final Dimension preferredSize = getPreferredSize();
- setPreferredSize(new Dimension(preferredSize.width, d.height / 4));
- setMinimumSize(new Dimension(preferredSize.width, 100));
+ setPreferredSize(new Dimension(preferredSize.width, 200));
+ setMinimumSize(getPreferredSize());
}
}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java
index 2ae3030d7d00..4cbb4489199b 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java
@@ -21,15 +21,16 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.ui.Util;
import com.intellij.openapi.roots.JavadocOrderRootType;
-import com.intellij.openapi.ui.PanelWithText;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ColoredTableCellRenderer;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.TableUtil;
+import com.intellij.ui.components.JBLabel;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ui.ItemRemovable;
import com.intellij.util.ui.Table;
+import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import javax.swing.border.Border;
@@ -83,9 +84,7 @@ public class JavadocEditor extends ModuleElementsEditor {
}
public JComponent createComponentImpl() {
- final JPanel mainPanel = new JPanel(new BorderLayout());
- mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
- mainPanel.setPreferredSize(new Dimension(-1, 200));
+ final JPanel mainPanel = new JPanel(new BorderLayout(5, 10));
final DefaultTableModel tableModel = createModel();
myTable = new Table(tableModel);
myTable.setIntercellSpacing(new Dimension(0, 0));
@@ -113,15 +112,13 @@ public class JavadocEditor extends ModuleElementsEditor {
});
final JPanel panel = new JPanel(new GridBagLayout());
- panel.add(myAddPathButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 6, 0, 0), 0, 0));
- panel.add(myAddUrlButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
- panel.add(myRemoveButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0));
+ panel.add(myAddPathButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ panel.add(myAddUrlButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0));
+ panel.add(myRemoveButton, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0));
mainPanel.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
mainPanel.add(panel, BorderLayout.EAST);
- final PanelWithText panelWithText = new PanelWithText(ProjectBundle.message("project.roots.javadoc.tab.description"));
- panelWithText.setBorder(null);
- mainPanel.add(panelWithText, BorderLayout.NORTH);
+ mainPanel.add(new JBLabel(ProjectBundle.message("project.roots.javadoc.tab.description"), UIUtil.ComponentStyle.SMALL, UIUtil.FontColor.BRIGHTER), BorderLayout.NORTH);
myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/OutputEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/OutputEditor.java
index 9b9cecbce37d..1f6c7e98882a 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/OutputEditor.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/OutputEditor.java
@@ -24,10 +24,12 @@ package com.intellij.openapi.roots.ui.configuration;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.ui.IdeBorderFactory;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import javax.swing.border.EmptyBorder;
import java.awt.*;
public class OutputEditor extends ModuleElementsEditor {
@@ -44,18 +46,17 @@ public class OutputEditor extends ModuleElementsEditor {
protected JComponent createComponentImpl() {
final JPanel panel = new JPanel(new GridBagLayout());
+ panel.setBorder(new EmptyBorder(UIUtil.PANEL_SMALL_INSETS));
final GridBagConstraints gc =
- new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
+ new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0);
panel.add(myCompilerOutputEditor.createComponentImpl(), gc);
final JPanel javadocPanel = (JPanel)myJavadocEditor.createComponentImpl();
javadocPanel.setBorder(IdeBorderFactory.createTitledBorder(myJavadocEditor.getDisplayName(), false, false, true));
+ gc.weighty = 1;
panel.add(javadocPanel, gc);
final JPanel annotationsPanel = (JPanel)myAnnotationsEditor.createComponentImpl();
annotationsPanel.setBorder(IdeBorderFactory.createTitledBorder(myAnnotationsEditor.getDisplayName(), false, false, true));
panel.add(annotationsPanel, gc);
- panel.add(Box.createVerticalBox(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 1, GridBagConstraints.CENTER,
- GridBagConstraints.BOTH, new Insets(0,0,0,0), 0, 0));
- panel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
return panel;
}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java
index f3959c21ff8a..c69cd57bc5af 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java
@@ -61,7 +61,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import javax.swing.border.Border;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import java.awt.*;
@@ -198,8 +197,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
Splitter splitter = new Splitter(false);
final JPanel leftPanel = new JPanel(new BorderLayout());
leftPanel.add(myLayoutTreeComponent.getTreePanel(), BorderLayout.CENTER);
- final Border border = BorderFactory.createEmptyBorder(3, 3, 3, 3);
- leftPanel.setBorder(border);
+ leftPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 0));
splitter.setFirstComponent(leftPanel);
final JPanel rightPanel = new JPanel(new BorderLayout());
@@ -224,7 +222,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
rightTopPanel.add(labelPanel, BorderLayout.SOUTH);
rightPanel.add(rightTopPanel, BorderLayout.NORTH);
rightPanel.add(ScrollPaneFactory.createScrollPane(mySourceItemsTree), BorderLayout.CENTER);
- rightPanel.setBorder(border);
+ rightPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3));
splitter.setSecondComponent(rightPanel);
diff --git a/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java b/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java
index b036d3ab8487..eb4ccea4bfbd 100644
--- a/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/CodeInsightUtil.java
@@ -230,6 +230,8 @@ public class CodeInsightUtil {
}, new Comparator() {
@Override
public int compare(PsiElement o1, PsiElement o2) {
+ if (!o1.textMatches(o2)) return 1;
+
if (o1 instanceof PsiDiamondTypeElementImpl && o2 instanceof PsiDiamondTypeElementImpl) {
final PsiDiamondType.DiamondInferenceResult thisInferenceResult = new PsiDiamondTypeImpl(o1.getManager(), (PsiTypeElement)o1).resolveInferredTypes();
final PsiDiamondType.DiamondInferenceResult otherInferenceResult = new PsiDiamondTypeImpl(o2.getManager(), (PsiTypeElement)o2).resolveInferredTypes();
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
index 0e8f314847b5..0dbb2f44ac76 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
@@ -730,16 +730,9 @@ public class JavaCompletionUtil {
if (psiClass.isValid() && !psiClass.getManager().areElementsEquivalent(psiClass, resolveReference(ref))) {
final boolean staticImport = ref instanceof PsiImportStaticReferenceElement;
- CodeEditUtil.setAllowSuspendNodesReformatting(true);
- PsiElement newElement;
- try {
- newElement = staticImport
- ? ((PsiImportStaticReferenceElement)ref).bindToTargetClass(psiClass)
- : ref.bindToElement(psiClass);
- }
- finally {
- CodeEditUtil.setAllowSuspendNodesReformatting(false);
- }
+ PsiElement newElement = staticImport
+ ? ((PsiImportStaticReferenceElement)ref).bindToTargetClass(psiClass)
+ : ref.bindToElement(psiClass);
newElement = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(newElement);
if (newElement != null) {
diff --git a/java/java-impl/src/com/intellij/refactoring/psi/PropertyUtils.java b/java/java-impl/src/com/intellij/refactoring/psi/PropertyUtils.java
index 47f7ac6d3098..44fc7a5725b0 100644
--- a/java/java-impl/src/com/intellij/refactoring/psi/PropertyUtils.java
+++ b/java/java-impl/src/com/intellij/refactoring/psi/PropertyUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,7 +95,14 @@ public class PropertyUtils {
}
final PsiReferenceExpression reference = (PsiReferenceExpression)value;
final PsiExpression qualifier = reference.getQualifierExpression();
- if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) {
+ if (qualifier instanceof PsiReferenceExpression) {
+ final PsiReferenceExpression referenceExpression = (PsiReferenceExpression)qualifier;
+ final PsiElement target = referenceExpression.resolve();
+ if (!(target instanceof PsiClass)) {
+ return null;
+ }
+ }
+ else if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) {
return null;
}
final PsiElement referent = reference.resolve();
@@ -171,7 +178,14 @@ public class PropertyUtils {
}
final PsiReferenceExpression reference = (PsiReferenceExpression)lhs;
final PsiExpression qualifier = reference.getQualifierExpression();
- if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) {
+ if (qualifier instanceof PsiReferenceExpression) {
+ final PsiReferenceExpression referenceExpression = (PsiReferenceExpression)qualifier;
+ final PsiElement target = referenceExpression.resolve();
+ if (!(target instanceof PsiClass)) {
+ return null;
+ }
+ }
+ else if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) {
return null;
}
final PsiElement referent = reference.resolve();
@@ -216,4 +230,67 @@ public class PropertyUtils {
public static boolean isSimpleSetter(PsiMethod method) {
return getFieldOfSetter(method) != null;
}
+
+ @Nullable
+ public static PsiMethod getReversePropertyMethod(PsiMethod propertyMethod) {
+ if (propertyMethod == null) {
+ return null;
+ }
+ final PsiClass aClass = propertyMethod.getContainingClass();
+ if (aClass == null) {
+ return null;
+ }
+ final String methodName = propertyMethod.getName();
+ final String prefix;
+ if (methodName.startsWith("get")) {
+ prefix = "get";
+ }
+ else if (methodName.startsWith("is")) {
+ prefix = "is";
+ }
+ else if (methodName.startsWith("set")) {
+ prefix = "set";
+ }
+ else {
+ throw new IllegalArgumentException("argument is not a setter or getter");
+ }
+ final String name = methodName.substring(prefix.length());
+ final PsiField field;
+ if (prefix.equals("set")) {
+ field = PropertyUtils.getFieldOfSetter(propertyMethod);
+ }
+ else {
+ field = PropertyUtils.getFieldOfGetter(propertyMethod);
+ }
+ if (field == null) {
+ return null;
+ }
+ if (prefix.equals("set")) {
+ final PsiMethod result = findPropertyMethod(aClass, "get", name, field);
+ if (result != null) {
+ return result;
+ }
+ return findPropertyMethod(aClass, "is", name, field);
+ }
+ else {
+ return findPropertyMethod(aClass, "set", name, field);
+ }
+ }
+
+ private static PsiMethod findPropertyMethod(PsiClass aClass, String prefix, String propertyName, PsiField field1) {
+ final PsiMethod[] methods = aClass.findMethodsByName(prefix + propertyName, true);
+ for (PsiMethod method : methods) {
+ final PsiField field2;
+ if (prefix.equals("set")) {
+ field2 = PropertyUtils.getFieldOfSetter(method);
+ }
+ else {
+ field2 = PropertyUtils.getFieldOfGetter(method);
+ }
+ if (field1.equals(field2)) {
+ return method;
+ }
+ }
+ return null;
+ }
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaAnnotationElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaAnnotationElementType.java
index 90eab205435b..962e371793b3 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaAnnotationElementType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaAnnotationElementType.java
@@ -48,12 +48,12 @@ public class JavaAnnotationElementType extends JavaStubElementType extends StubBasedPsiElementBase implements StubBasedPsiElement {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.JavaStubPsiElement");
- public JavaStubPsiElement(final T stub, IStubElementType nodeType) {
+ public JavaStubPsiElement(@NotNull T stub, @NotNull IStubElementType nodeType) {
super(stub, nodeType);
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
index 38ff553b541d..ac27a012a2a9 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
@@ -44,11 +44,11 @@ public class PsiParameterImpl extends JavaStubPsiElement imple
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiParameterImpl");
private volatile PatchedSoftReference myCachedType = null;
- public PsiParameterImpl(final PsiParameterStub stub) {
+ public PsiParameterImpl(@NotNull PsiParameterStub stub) {
super(stub, JavaStubElementTypes.PARAMETER);
}
- public PsiParameterImpl(final ASTNode node) {
+ public PsiParameterImpl(@NotNull ASTNode node) {
super(node);
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterListImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterListImpl.java
index b224bac150d7..687c19f90dfe 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterListImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterListImpl.java
@@ -31,11 +31,11 @@ import org.jetbrains.annotations.NotNull;
public class PsiParameterListImpl extends JavaStubPsiElement implements PsiParameterList {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiParameterListImpl");
- public PsiParameterListImpl(final PsiParameterListStub stub) {
+ public PsiParameterListImpl(@NotNull PsiParameterListStub stub) {
super(stub, JavaStubElementTypes.PARAMETER_LIST);
}
- public PsiParameterListImpl(final ASTNode node) {
+ public PsiParameterListImpl(@NotNull ASTNode node) {
super(node);
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ParameterElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ParameterElement.java
index c373753f96ae..0d3aeac52c66 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ParameterElement.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/ParameterElement.java
@@ -18,7 +18,6 @@ package com.intellij.psi.impl.source.tree.java;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.JavaTokenType;
-import com.intellij.psi.impl.source.Constants;
import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.psi.impl.source.tree.CompositeElement;
import com.intellij.psi.impl.source.tree.JavaElementType;
@@ -29,7 +28,7 @@ public class ParameterElement extends CompositeElement{
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.ParameterElement");
public ParameterElement() {
- super(Constants.PARAMETER);
+ super(JavaElementType.PARAMETER);
}
protected ParameterElement(IElementType type) {
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
index b691004f3053..d05310987c1a 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
@@ -621,7 +621,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
public void testSpacesAroundEq() throws Throwable { doTest('='); }
- public void testClassBeforeCast() throws Throwable { doTest '\n' }
+ public void _testClassBeforeCast() throws Throwable { doTest '\n' }
public void testNoAllClassesOnQualifiedReference() throws Throwable {
configureByFile(getTestName(false) + ".java");
diff --git a/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java b/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java
index e698723506e7..a03fb0c5f9b8 100644
--- a/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java
+++ b/platform/core-api/src/com/intellij/psi/stubs/IStubElementType.java
@@ -32,9 +32,9 @@ public abstract class IStubElementType
* This method is called with 'false' argument;
* Document is processed at dedicated 'try' block;
- * This method is called with 'false' argument from 'finally' section;
+ * This method is called with 'true' argument from 'finally' section;
*
*/
diff --git a/platform/icons/src/general/comboArrowDown.png b/platform/icons/src/general/comboArrowDown.png
new file mode 100644
index 000000000000..96d6cca1c07d
Binary files /dev/null and b/platform/icons/src/general/comboArrowDown.png differ
diff --git a/platform/lang-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java b/platform/lang-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java
index e86dd5aa7469..4da3f17387eb 100644
--- a/platform/lang-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java
+++ b/platform/lang-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java
@@ -72,8 +72,12 @@ public class PsiEquivalenceUtil {
}
if (children1.length == 0) {
- if (!element1.textMatches(element2)) return false;
- if (leafElementsComparator != null && leafElementsComparator.compare(element1, element2) != 0) return false;
+ if (leafElementsComparator != null) {
+ if (leafElementsComparator.compare(element1, element2) != 0) return false;
+ }
+ else {
+ if (!element1.textMatches(element2)) return false;
+ }
}
PsiReference ref1 = element1.getReference();
diff --git a/platform/lang-api/src/com/intellij/psi/stubs/EmptyStubElementType.java b/platform/lang-api/src/com/intellij/psi/stubs/EmptyStubElementType.java
index 15d0b7d7d84d..89195d017325 100644
--- a/platform/lang-api/src/com/intellij/psi/stubs/EmptyStubElementType.java
+++ b/platform/lang-api/src/com/intellij/psi/stubs/EmptyStubElementType.java
@@ -17,7 +17,7 @@ public abstract class EmptyStubElementType extends IStubEl
}
@Override
- public final EmptyStub createStub(T psi, StubElement parentStub) {
+ public final EmptyStub createStub(@NotNull T psi, StubElement parentStub) {
return createStub(parentStub);
}
diff --git a/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java b/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java
index b7fafec0bfd3..a3b4ba723c13 100644
--- a/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java
+++ b/platform/lang-impl/src/com/intellij/application/options/InitialConfigurationDialog.java
@@ -159,6 +159,11 @@ public class InitialConfigurationDialog extends DialogWrapper {
return myHidingPreviewPanel;
}
+ @Override
+ protected void initOnImpl() {
+ //?
+ }
+
@Override
protected void onImpl() {
myWrapper.setVisible(true);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java
index 7b57fa44d292..91972927595b 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java
@@ -118,6 +118,7 @@ public class SurroundWithHandler implements CodeInsightActionHandler {
final PsiElement[] elements = descriptor.getElementsToSurround(file, startOffset, endOffset);
if (elements.length > 0) {
for (PsiElement element : elements) {
+ assert element != null : "descriptor " + descriptor + " returned null element";
assert element.isValid() : descriptor;
}
for (Surrounder s: descriptor.getSurrounders()) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowContainerInfoHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowContainerInfoHandler.java
index 8ef7ca97e746..92fb7bd5dd00 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowContainerInfoHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ShowContainerInfoHandler.java
@@ -37,58 +37,73 @@ import java.lang.ref.WeakReference;
public class ShowContainerInfoHandler implements CodeInsightActionHandler {
private static final Key> MY_LAST_HINT_KEY = Key.create("MY_LAST_HINT_KEY");
+ private static final Key CONTAINER_KEY = Key.create("CONTAINER_KEY");
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
PsiDocumentManager.getInstance(project).commitAllDocuments();
-
+ PsiElement container = null;
WeakReference ref = editor.getUserData(MY_LAST_HINT_KEY);
if (ref != null){
LightweightHint hint = ref.get();
if (hint != null && hint.isVisible()){
hint.hide();
+ container = hint.getUserData(CONTAINER_KEY);
+ if (container != null && !container.isValid()){
+ container = null;
+ }
}
}
- PsiElement container = null;
- StructureViewBuilder builder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(file);
- if (builder instanceof TreeBasedStructureViewBuilder) {
- StructureViewModel model = ((TreeBasedStructureViewBuilder) builder).createStructureViewModel();
+ StructureViewBuilder builder = LanguageStructureViewBuilder.INSTANCE.getStructureViewBuilder(file);
+ if (builder instanceof TreeBasedStructureViewBuilder) {
+ StructureViewModel model = ((TreeBasedStructureViewBuilder) builder).createStructureViewModel();
+ boolean goOneLevelUp = true;
+ if (container == null) {
+ goOneLevelUp = false;
Object element = model.getCurrentEditorElement();
if (element instanceof PsiElement) {
container = (PsiElement) element;
- while(true) {
- if (container == null || container instanceof PsiFile) {
- return;
- }
- if (!isDeclarationVisible(container, editor)) {
- break;
- }
-
- container = container.getParent();
- while(container != null && DeclarationRangeUtil.getPossibleDeclarationAtRange(container) == null) {
- container = container.getParent();
- if (container instanceof PsiFile) return;
- }
- }
}
}
- if (container == null) {
- return;
+ while(true) {
+ if (container == null || container instanceof PsiFile) {
+ return;
+ }
+ if (goOneLevelUp) {
+ goOneLevelUp = false;
+ }
+ else {
+ if (!isDeclarationVisible(container, editor)) {
+ break;
+ }
+ }
+
+ container = container.getParent();
+ while(container != null && DeclarationRangeUtil.getPossibleDeclarationAtRange(container) == null) {
+ container = container.getParent();
+ if (container instanceof PsiFile) return;
+ }
}
+ }
+ if (container == null) {
+ return;
+ }
final TextRange range = DeclarationRangeUtil.getPossibleDeclarationAtRange(container);
if (range == null) {
return;
}
+ final PsiElement _container = container;
ApplicationManager.getApplication().invokeLater(new Runnable() {
- public void run() {
- LightweightHint hint = EditorFragmentComponent.showEditorFragmentHint(editor, range, true, true);
- if (hint != null) {
- editor.putUserData(MY_LAST_HINT_KEY, new WeakReference(hint));
- }
+ public void run() {
+ LightweightHint hint = EditorFragmentComponent.showEditorFragmentHint(editor, range, true, true);
+ if (hint != null) {
+ hint.putUserData(CONTAINER_KEY, _container);
+ editor.putUserData(MY_LAST_HINT_KEY, new WeakReference(hint));
}
- });
+ }
+ });
}
public boolean startInWriteAction() {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/EndHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/EndHandler.java
index 419d88935ad3..4ed85cc4e528 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/EndHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/EndHandler.java
@@ -36,6 +36,7 @@ public class EndHandler extends EditorActionHandler {
return;
}
+ lookup.markSelectionTouched();
ListScrollingUtil.moveEnd(lookup.getList());
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/HomeHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/HomeHandler.java
index a8699b9454c8..3e742eb90e94 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/HomeHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/HomeHandler.java
@@ -36,6 +36,7 @@ public class HomeHandler extends EditorActionHandler {
return;
}
+ lookup.markSelectionTouched();
ListScrollingUtil.moveHome(lookup.getList());
}
}
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
index 1d20e51a57e2..ba8cd9f2fbdd 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
@@ -95,7 +95,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
private static final int FLUSH_DELAY = 200; //TODO : make it an option
- private static final Key CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW");
+ public static final Key CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW");
static {
final EditorActionManager actionManager = EditorActionManager.getInstance();
diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java
index 98e8b48a1af8..01c6bb74aee3 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/FindDialog.java
@@ -806,7 +806,12 @@ public class FindDialog extends DialogWrapper {
gbConstraints.gridx++;
gbConstraints.weightx = 1;
gbConstraints.gridwidth = 2;
- myScopeCombo = new ScopeChooserCombo(myProject, true, true, FindSettings.getInstance().getDefaultScopeName());
+ myScopeCombo = new ScopeChooserCombo(myProject, true, true, FindSettings.getInstance().getDefaultScopeName()) {
+ @Override
+ public Dimension getMinimumSize() {
+ return new Dimension(200, super.getMinimumSize().height);
+ }
+ };
Disposer.register(myDisposable, myScopeCombo);
scopePanel.add(myScopeCombo, gbConstraints);
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/StructureViewModuleNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/StructureViewModuleNode.java
index 14fbc7249c8e..c9d8ac8b2fff 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/StructureViewModuleNode.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/StructureViewModuleNode.java
@@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
public class StructureViewModuleNode extends AbstractModuleNode {
@@ -34,15 +35,20 @@ public class StructureViewModuleNode extends AbstractModuleNode {
@NotNull
public Collection getChildren() {
+ final Module module = getValue();
+ if (module == null) {
+ // just deleted a module from project view
+ return Collections.emptyList();
+ }
final List children = new ArrayList(2);
- children.add(new LibraryGroupNode(getProject(), new LibraryGroupElement(getValue()), getSettings()) {
+ children.add(new LibraryGroupNode(getProject(), new LibraryGroupElement(module), getSettings()) {
@Override
public boolean isAlwaysExpand() {
return true;
}
});
- children.add(new ModuleListNode(getProject(), getValue(), getSettings()));
+ children.add(new ModuleListNode(getProject(), module, getSettings()));
return children;
}
diff --git a/platform/lang-impl/src/com/intellij/indentation/IndentationParser.java b/platform/lang-impl/src/com/intellij/indentation/IndentationParser.java
index 76b41402461d..7edfc9f94405 100644
--- a/platform/lang-impl/src/com/intellij/indentation/IndentationParser.java
+++ b/platform/lang-impl/src/com/intellij/indentation/IndentationParser.java
@@ -79,7 +79,7 @@ public abstract class IndentationParser implements PsiParser {
currentIndent = 0;
}
}
- builder.advanceLexer();
+ advanceLexer(builder);
}
// Close all left opened markers
@@ -90,10 +90,20 @@ public abstract class IndentationParser implements PsiParser {
stack.pop().second.done(myBlockElementType);
}
+ return buildTree(fileMarker, builder, root);
+ }
+
+ protected ASTNode buildTree(final PsiBuilder.Marker fileMarker,
+ final PsiBuilder builder,
+ final IElementType root) {
fileMarker.done(root);
return builder.getTreeBuilt();
}
+ protected void advanceLexer(PsiBuilder builder) {
+ builder.advanceLexer();
+ }
+
private void passEOLsAndIndents(final PsiBuilder builder) {
IElementType tokenType = builder.getTokenType();
while (tokenType == myEolTokenType || tokenType == myIndentTokenType){
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
index 45cb44146e42..909fa7e4e1c0 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
@@ -534,9 +534,6 @@ public class SingleInspectionProfilePanel extends JPanel {
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
TreeUtil.collapseAll(myTree, 1);
- final Dimension preferredSize = new Dimension(myTree.getPreferredSize().width + 20, scrollPane.getPreferredSize().height);
- //scrollPane.setPreferredSize(preferredSize);
- //scrollPane.setMinimumSize(preferredSize);
myTree.addTreeExpansionListener(new TreeExpansionListener() {
@@ -566,7 +563,6 @@ public class SingleInspectionProfilePanel extends JPanel {
myTreeExpander = new DefaultTreeExpander(myTree);
myProfileFilter = new MyFilterComponent();
- myProfileFilter.setPreferredSize(new Dimension(100, -1));
return scrollPane;
}
@@ -905,10 +901,10 @@ public class SingleInspectionProfilePanel extends JPanel {
final JScrollPane tree = initTreeScrollPane();
treePanel.add(tree, BorderLayout.CENTER);
- final JPanel northPanel = new JPanel(new BorderLayout());
+ final JPanel northPanel = new JPanel(new GridBagLayout());
northPanel.setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 2, 0));
- northPanel.add(createTreeToolbarPanel().getComponent(), BorderLayout.CENTER);
- northPanel.add(myProfileFilter, BorderLayout.EAST);
+ northPanel.add(createTreeToolbarPanel().getComponent(), new GridBagConstraints(0, 0, 1, 1, 0.5, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ northPanel.add(myProfileFilter, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.BASELINE_TRAILING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
treePanel.add(northPanel, BorderLayout.NORTH);
myMainSplitter = new Splitter(false);
@@ -919,7 +915,6 @@ public class SingleInspectionProfilePanel extends JPanel {
final JPanel panel = new JPanel(new BorderLayout());
panel.add(myMainSplitter, BorderLayout.CENTER);
- panel.setBorder(IdeBorderFactory.createEmptyBorder(2, 2, 0, 2));
return panel;
}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
index d7f668616ae5..d4a5663304ae 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java
@@ -469,13 +469,17 @@ public abstract class AbstractInplaceIntroducer extends DialogWrapper {
panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
- panel.add(buttonPanel, BorderLayout.EAST);
if (SystemInfo.isMac) {
+ panel.add(buttonPanel, BorderLayout.EAST);
+ buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
+
myHelpButton.putClientProperty("JButton.buttonType", "help");
if (UIUtil.isUnderAquaLookAndFeel()) {
myHelpButton.setText("");
@@ -127,7 +130,6 @@ public abstract class AbstractWizard extends DialogWrapper {
leftPanel.add(myHelpButton);
}
leftPanel.add(myCancelButton);
-
panel.add(leftPanel, BorderLayout.WEST);
buttonPanel.add(myFinishButton);
@@ -139,20 +141,31 @@ public abstract class AbstractWizard extends DialogWrapper {
}
}
else {
+ panel.add(buttonPanel, BorderLayout.CENTER);
+ GroupLayout layout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(layout);
+ layout.setAutoCreateGaps(true);
+
+ final GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
+ final GroupLayout.ParallelGroup vGroup = layout.createParallelGroup();
+ final Collection buttons = Lists.newArrayListWithExpectedSize(5);
+ final boolean helpAvailable = ApplicationInfo.contextHelpAvailable();
+
+ if (helpAvailable && UIUtil.isUnderGTKLookAndFeel()) {
+ add(hGroup, vGroup, buttons, myHelpButton);
+ }
+ add(hGroup, vGroup, null, Box.createHorizontalGlue());
if (mySteps.size() > 1) {
- buttonPanel.add(myPreviousButton);
- buttonPanel.add(Box.createHorizontalStrut(5));
- buttonPanel.add(myNextButton);
- buttonPanel.add(Box.createHorizontalStrut(5));
+ add(hGroup, vGroup, buttons, myPreviousButton, myNextButton);
+ }
+ add(hGroup, vGroup, buttons, myFinishButton, myCancelButton);
+ if (helpAvailable && !UIUtil.isUnderGTKLookAndFeel()) {
+ add(hGroup, vGroup, buttons, myHelpButton);
}
- buttonPanel.add(myFinishButton);
- buttonPanel.add(Box.createHorizontalStrut(5));
- buttonPanel.add(myCancelButton);
- buttonPanel.add(Box.createHorizontalStrut(5));
- if (ApplicationInfo.contextHelpAvailable()) {
- buttonPanel.add(myHelpButton);
- }
+ layout.setHorizontalGroup(hGroup);
+ layout.setVerticalGroup(vGroup);
+ layout.linkSize(buttons.toArray(new Component[buttons.size()]));
}
myPreviousButton.setEnabled(false);
@@ -201,6 +214,17 @@ public abstract class AbstractWizard extends DialogWrapper {
return panel;
}
+ private static void add(final GroupLayout.Group hGroup,
+ final GroupLayout.Group vGroup,
+ @Nullable final Collection collection,
+ final Component... components) {
+ for (Component component : components) {
+ hGroup.addComponent(component);
+ vGroup.addComponent(component);
+ if (collection != null) collection.add(component);
+ }
+ }
+
private static class TallImageComponent extends OpaquePanel {
private Icon myIcon;
@@ -217,13 +241,13 @@ public abstract class AbstractWizard extends DialogWrapper {
myIcon.paintIcon(this, gg, 0, 0);
final Rectangle bounds = g.getClipBounds();
- int y = bounds.y;
+ int y = myIcon.getIconHeight()-1;
while (y < bounds.y + bounds.height) {
g.drawImage(image,
- bounds.x, y, bounds.x + bounds.width, y + 5,
- 0, myIcon.getIconHeight() - 10, bounds.width, myIcon.getIconHeight() - 5, this);
+ bounds.x, y, bounds.x + bounds.width, y + 1,
+ 0, myIcon.getIconHeight() - 1, bounds.width, myIcon.getIconHeight(), this);
- y += 5;
+ y++;
}
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
index b2cbf6be8258..63c853ea532c 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
@@ -368,6 +368,10 @@ public abstract class DialogWrapper {
}
}
}
+ else if (UIUtil.isUnderGTKLookAndFeel() && Arrays.asList(actions).contains(getHelpAction())) {
+ leftSideActions = ArrayUtil.append(leftSideActions, getHelpAction());
+ actions = ArrayUtil.remove(actions, getHelpAction());
+ }
JPanel panel = new JPanel(new BorderLayout());
final JPanel lrButtonsPanel = new JPanel(new GridBagLayout());
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBCheckBox.java b/platform/platform-api/src/com/intellij/ui/components/JBCheckBox.java
index 839146897853..d64551ddf6ef 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBCheckBox.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBCheckBox.java
@@ -9,7 +9,7 @@ import java.awt.*;
* @author evgeny.zakrevsky
*/
public class JBCheckBox extends JCheckBox implements AnchorableComponent {
- private JComponent anchor;
+ private JComponent myAnchor;
public JBCheckBox() {
super();
@@ -46,18 +46,23 @@ public class JBCheckBox extends JCheckBox implements AnchorableComponent {
@Override
public JComponent getAnchor() {
- return anchor;
+ return myAnchor;
}
@Override
public void setAnchor(JComponent anchor) {
if (this != anchor) {
- this.anchor = anchor;
+ this.myAnchor = anchor;
}
}
@Override
public Dimension getPreferredSize() {
- return anchor == null ? super.getPreferredSize() : anchor.getPreferredSize();
+ return myAnchor == null ? super.getPreferredSize() : myAnchor.getPreferredSize();
+ }
+
+ @Override
+ public Dimension getMinimumSize() {
+ return myAnchor == null ? super.getMinimumSize() : myAnchor.getMinimumSize();
}
}
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBLabel.java b/platform/platform-api/src/com/intellij/ui/components/JBLabel.java
index e19c7d0fcfa7..4ced2491f3af 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBLabel.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBLabel.java
@@ -30,9 +30,11 @@ public class JBLabel extends JLabel implements AnchorableComponent {
private JComponent myAnchor = null;
public JBLabel() {
+ super();
}
public JBLabel(@NotNull UIUtil.ComponentStyle componentStyle) {
+ super();
setComponentStyle(componentStyle);
}
@@ -49,6 +51,12 @@ public class JBLabel extends JLabel implements AnchorableComponent {
setComponentStyle(componentStyle);
}
+ public JBLabel(@NotNull String text, @NotNull UIUtil.ComponentStyle componentStyle, @NotNull UIUtil.FontColor fontColor) {
+ super(text);
+ setComponentStyle(componentStyle);
+ setFontColor(fontColor);
+ }
+
public JBLabel(@NotNull String text, int horizontalAlignment) {
super(text, horizontalAlignment);
}
@@ -101,4 +109,9 @@ public class JBLabel extends JLabel implements AnchorableComponent {
public Dimension getPreferredSize() {
return myAnchor == null ? super.getPreferredSize() : myAnchor.getPreferredSize();
}
+
+ @Override
+ public Dimension getMinimumSize() {
+ return myAnchor == null ? super.getMinimumSize() : myAnchor.getMinimumSize();
+ }
}
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBRadioButton.java b/platform/platform-api/src/com/intellij/ui/components/JBRadioButton.java
index 4d1f7432e944..a075495edf5e 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBRadioButton.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBRadioButton.java
@@ -10,7 +10,7 @@ import java.awt.*;
* @author evgeny.zakrevsky
*/
public class JBRadioButton extends JRadioButton implements AnchorableComponent {
- private JComponent anchor;
+ private JComponent myAnchor;
public JBRadioButton() {
}
@@ -45,18 +45,23 @@ public class JBRadioButton extends JRadioButton implements AnchorableComponent {
@Override
public JComponent getAnchor() {
- return anchor;
+ return myAnchor;
}
@Override
public void setAnchor(@Nullable JComponent anchor) {
if (anchor != this) {
- this.anchor = anchor;
+ this.myAnchor = anchor;
}
}
@Override
public Dimension getPreferredSize() {
- return anchor == null ? super.getPreferredSize() : anchor.getPreferredSize();
+ return myAnchor == null ? super.getPreferredSize() : myAnchor.getPreferredSize();
+ }
+
+ @Override
+ public Dimension getMinimumSize() {
+ return myAnchor == null ? super.getMinimumSize() : myAnchor.getMinimumSize();
}
}
diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java
index 15bcc6c4ab7e..92faf0983a2b 100644
--- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java
+++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java
@@ -53,7 +53,12 @@ public class JBEditorTabs extends JBTabsImpl {
super.paintLastGhost(g2d);
}
}
-
+
+ @Override
+ public boolean isTabDraggingEnabled() {
+ return super.isTabDraggingEnabled() && isSingleRow();
+ }
+
public boolean isGhostsAlwaysVisible() {
return super.isGhostsAlwaysVisible() && !isEditorTabs();
}
@@ -71,7 +76,7 @@ public class JBEditorTabs extends JBTabsImpl {
int _height = effectiveBounds.height - insets.top - insets.bottom;
- if ((!isSingleRow() && label.getBounds().y > 0 /* for multiline */) || (isSingleRow() && isHorizontalTabs())) {
+ if ((!isSingleRow() /* for multiline */) || (isSingleRow() && isHorizontalTabs())) {
if (isSingleRow() && getPosition() == JBTabsPosition.bottom) {
_y += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
} else {
diff --git a/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java b/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java
index 47bdc4769a07..117815929b75 100644
--- a/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java
+++ b/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java
@@ -25,12 +25,15 @@ import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.mac.foundation.Foundation;
import com.intellij.ui.mac.foundation.ID;
+import com.intellij.ui.mac.foundation.MacUtil;
+import com.sun.jna.Callback;
import com.sun.jna.IntegerType;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.awt.datatransfer.DataTransferer;
+import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.io.IOException;
@@ -180,8 +183,31 @@ public class ClipboardSynchronizer implements ApplicationComponent {
private static class MacClipboardHandler extends ClipboardHandler {
+ private static final String CLIPBOARD_CONTENTS = "CLIPBOARD_CONTENTS";
private Pair myFullTransferable;
+ private static Callback myClipboardQueryCallback = new Callback() {
+ public void callback(ID self, String selector, ID params) {
+ JRootPane pane = getRootPane();
+ if (pane != null) {
+ Transferable transferable = getClipboardContentNatively();
+ if (transferable != null) {
+ pane.putClientProperty(CLIPBOARD_CONTENTS, transferable);
+ }
+ }
+ }
+ };
+
+ static {
+ if (SystemInfo.isMac) {
+ final ID delegateClass = Foundation.allocateObjcClassPair(Foundation.getClass("NSObject"), "ClipboardSynchronizer_");
+ if (!Foundation.addMethod(delegateClass, Foundation.createSelector("run:"), myClipboardQueryCallback, "v*")) {
+ throw new RuntimeException("Unable to add method to objective-c delegate class!");
+ }
+ Foundation.registerObjcClassPair(delegateClass);
+ }
+ }
+
@Nullable
private Transferable doGetContents() throws IllegalStateException {
if (Registry.is("ide.mac.useNativeClipboard")) {
@@ -247,43 +273,45 @@ public class ClipboardSynchronizer implements ApplicationComponent {
super.setContent(content, owner);
}
}
+
+ @Nullable
+ private static JRootPane getRootPane() {
+ Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+ if (window == null) return null;
+ return SwingUtilities.getRootPane(window);
+ }
+ @Nullable
public static Transferable getContentsSafe() {
+ if (Registry.is("ide.mac.useNativeClipboard.async")) {
+ JRootPane pane = getRootPane();
+ if (pane != null) {
+ ID synchronizer_ = Foundation.getClass("ClipboardSynchronizer_");
+ final ID synchronizer = Foundation.invoke(Foundation.invoke(synchronizer_, "alloc"), "init");
+ Foundation
+ .invoke(synchronizer, "performSelectorOnMainThread:withObject:waitUntilDone:", Foundation.createSelector("run:"), null, false);
+
+ MacUtil.startModal(pane);
+
+ Foundation.cfRelease(synchronizer);
+
+ Object contents = pane.getClientProperty(CLIPBOARD_CONTENTS);
+ pane.putClientProperty(CLIPBOARD_CONTENTS, null);
+ if (contents != null) {
+ return (Transferable) contents;
+ }
+
+ return null;
+ }
+ }
+
final Ref result = new Ref();
Foundation.executeOnMainThread(new Runnable() {
@Override
public void run() {
- String plainText = "public.utf8-plain-text";
- String jvmObject = "application/x-java-jvm";
-
- ID pasteboard = Foundation.invoke("NSPasteboard", "generalPasteboard");
- ID types = Foundation.invoke(pasteboard, "types");
- IntegerType count = Foundation.invoke(types, "count");
-
- ID plainTextType = null;
-
- for (int i = 0; i < count.intValue(); i++) {
- ID each = Foundation.invoke(types, "objectAtIndex:", i);
- String eachType = Foundation.toStringViaUTF8(each);
- if (plainText.equals(eachType)) {
- plainTextType = each;
- break;
- }
- }
-
- // will put string value even if we doesn't found java object. this is needed because java caches clipboard value internally and
- // will reset it ONLY IF we'll put jvm-object into clipboard (see our setContent optimizations which avoids putting jvm-objects
- // into clipboard)
-
- if (plainTextType != null) {
- ID text = Foundation.invoke(pasteboard, "stringForType:", plainTextType);
- String value = Foundation.toStringViaUTF8(text);
- if (value == null) {
- LOG.info(String.format("[Clipboard] Strange string value (null?) for type: %s", plainTextType));
- }
- else {
- result.set(new StringSelection(value));
- }
+ Transferable transferable = getClipboardContentNatively();
+ if (transferable != null) {
+ result.set(transferable);
}
}
}, true, true);
@@ -291,6 +319,45 @@ public class ClipboardSynchronizer implements ApplicationComponent {
return result.get();
}
}
+
+ @Nullable
+ private static Transferable getClipboardContentNatively() {
+ String plainText = "public.utf8-plain-text";
+ String jvmObject = "application/x-java-jvm";
+
+ ID pasteboard = Foundation.invoke("NSPasteboard", "generalPasteboard");
+ ID types = Foundation.invoke(pasteboard, "types");
+ IntegerType count = Foundation.invoke(types, "count");
+
+ ID plainTextType = null;
+
+ for (int i = 0; i < count.intValue(); i++) {
+ ID each = Foundation.invoke(types, "objectAtIndex:", i);
+ String eachType = Foundation.toStringViaUTF8(each);
+ if (plainText.equals(eachType)) {
+ plainTextType = each;
+ break;
+ }
+ }
+
+ // will put string value even if we doesn't found java object. this is needed because java caches clipboard value internally and
+ // will reset it ONLY IF we'll put jvm-object into clipboard (see our setContent optimizations which avoids putting jvm-objects
+ // into clipboard)
+
+ Transferable result = null;
+ if (plainTextType != null) {
+ ID text = Foundation.invoke(pasteboard, "stringForType:", plainTextType);
+ String value = Foundation.toStringViaUTF8(text);
+ if (value == null) {
+ LOG.info(String.format("[Clipboard] Strange string value (null?) for type: %s", plainTextType));
+ }
+ else {
+ result = new StringSelection(value);
+ }
+ }
+
+ return result;
+ }
private static class LinuxClipboardHandler extends ClipboardHandler {
private static final FlavorTable FLAVOR_MAP = (FlavorTable)SystemFlavorMap.getDefaultFlavorMap();
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java b/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java
index 129086171e26..f0edf9dcda29 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
-import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.SystemInfo;
@@ -33,16 +32,18 @@ import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.ui.LicensingFacade;
import com.intellij.util.ImageLoader;
+import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
-import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
import java.util.List;
+import java.util.Properties;
public class AboutAction extends AnAction implements DumbAware {
@NonNls private static final String COMPANY_URL = "http://www.jetbrains.com/"; // TODO move to ApplicationInfo.xml
@@ -178,11 +179,9 @@ public class AboutAction extends AnAction implements DumbAware {
public InfoSurface(Image image) {
myImage = image;
-
setOpaque(false);
- //col = new Color(0xfa, 0xfa, 0xfa, 200);
col = Color.white;
- linkCol = ApplicationInfoImpl.getInstanceEx().getLogoTextColor();
+ linkCol = ApplicationInfoEx.getInstanceEx().getLogoTextColor();
setBackground(col);
ApplicationInfoEx ideInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
Calendar cal = ideInfo.getBuildDate();
@@ -192,9 +191,10 @@ public class AboutAction extends AnAction implements DumbAware {
if (ideInfo.getBuild().isSnapshot()) {
buildDate = new SimpleDateFormat("HH:mm, ").format(cal.getTime());
}
- buildDate += DateFormat.getDateInstance(DateFormat.LONG).format(cal.getTime());
+ buildDate += DateFormatUtil.formatAboutDialogDate(cal.getTime());
myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.build.date", buildDate)));
myLines.add(new AboutBoxLine(""));
+
LicensingFacade provider = LicensingFacade.getInstance();
if (provider != null) {
myLines.add(new AboutBoxLine(provider.getLicensedToMessage(), true, false));
@@ -204,13 +204,11 @@ public class AboutAction extends AnAction implements DumbAware {
}
myLines.add(new AboutBoxLine(""));
- {
- final Properties properties = System.getProperties();
- myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.jdk", properties.getProperty("java.version", "unknown")), true, false));
- myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.vm", properties.getProperty("java.vm.name", "unknown"))));
- myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.vendor", properties.getProperty("java.vendor", "unknown"))));
+ final Properties properties = System.getProperties();
+ myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.jdk", properties.getProperty("java.version", "unknown")), true, false));
+ myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.vm", properties.getProperty("java.vm.name", "unknown"))));
+ myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.vendor", properties.getProperty("java.vendor", "unknown"))));
- }
myLines.add(new AboutBoxLine(""));
myLines.add(new AboutBoxLine("JetBrains s.r.o.", true, false));
myLines.add(new AboutBoxLine(COMPANY_URL, true, true));
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
index d3a34ea078bc..3a51ce366750 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
@@ -27,7 +27,6 @@ import com.intellij.openapi.actionSystem.ActionToolbar;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.ui.Messages;
diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
index ef23e8aa07e1..bdd182ccc2df 100644
--- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsManagerImpl.java
@@ -243,8 +243,13 @@ public class NotificationsManagerImpl extends NotificationsManager implements No
}
}
+ @Nullable
public static Window findWindowForBalloon(Project project) {
- return WindowManager.getInstance().getFrame(project);
+ final JFrame frame = WindowManager.getInstance().getFrame(project);
+ if (frame == null && project == null) {
+ return KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+ }
+ return frame;
}
public static Balloon createBalloon(final Notification notification, final boolean showCallout, final boolean hideOnClickOutside, final boolean fadeOut) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
index a91d360ede33..9c7c302d025b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
@@ -419,7 +419,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
LOG.error(t);
}
finally {
- ReflectionUtil.resetThreadLocals();
+ //ReflectionUtil.resetThreadLocals();
Thread.interrupted(); // reset interrupted status
}
}
@@ -440,7 +440,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
LOG.error(t);
}
finally {
- ReflectionUtil.resetThreadLocals();
+ //ReflectionUtil.resetThreadLocals();
Thread.interrupted(); // reset interrupted status
}
return null;
diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffSplitter.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffSplitter.java
index 6da18259ece1..5f4507dcfad3 100644
--- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffSplitter.java
+++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffSplitter.java
@@ -40,6 +40,7 @@ class DiffSplitter extends Splitter implements DiffSplitterI {
setDividerWidth(30);
setFirstComponent(component1);
setSecondComponent(component2);
+ setHonorComponentsMinimumSize(false);
}
protected Splitter.Divider createDivider() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorFactoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorFactoryImpl.java
index 1aded33a9a4d..d66aa92c7f35 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorFactoryImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorFactoryImpl.java
@@ -42,6 +42,7 @@ import com.intellij.util.SmartList;
import com.intellij.util.text.CharArrayCharSequence;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.ArrayList;
@@ -104,7 +105,7 @@ public class EditorFactoryImpl extends EditorFactory {
@NonNls
public static String notReleasedError(@NotNull Editor editor) {
- final String creator = editor.getUserData(EDITOR_CREATOR);
+ final String creator = getCreator(editor);
if (creator == null) {
return "Editor of " + editor.getClass() +
" and the following text hasn't been released:\n" + editor.getDocument().getText();
@@ -114,6 +115,11 @@ public class EditorFactoryImpl extends EditorFactory {
}
}
+ @Nullable
+ static String getCreator(@NotNull Editor editor) {
+ return editor.getUserData(EDITOR_CREATOR);
+ }
+
@Override
public void disposeComponent() {
}
@@ -200,8 +206,8 @@ public class EditorFactoryImpl extends EditorFactory {
@Override
public void releaseEditor(@NotNull Editor editor) {
- editor.putUserData(EDITOR_CREATOR, null);
((EditorImpl)editor).release();
+ editor.putUserData(EDITOR_CREATOR, null);
myEditors.remove(editor);
myEditorFactoryEventDispatcher.getMulticaster().editorReleased(new EditorFactoryEvent(this, editor));
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
index 293e379296e4..0378c3835c03 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
@@ -644,10 +644,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
public void release() {
assertIsDispatchThread();
if (isReleased) {
- VirtualFile file = FileDocumentManager.getInstance().getFile(myDocument);
- String hint = file != null ? file.getPath() : myDocument.getText(TextRange.create(0, Math.min(100, myDocument.getTextLength())));
- LOG.error("Double release:\n" +
- hint + "\n" +
+ LOG.error("Double release of editor:\n" +
+ EditorFactoryImpl.getCreator(this) + "\n" +
"First released at: =====\n" + myReleasedAt + "\n======");
}
@@ -811,7 +809,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
myPanel.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
- myMarkupModel.repaint(0, myDocument.getTextLength());
+ myMarkupModel.recalcEditorDimensions();
+ myMarkupModel.repaint(-1, -1);
}
});
}
@@ -1572,7 +1571,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
myEditorComponent.setSize(dim);
myEditorComponent.fireResized();
- myMarkupModel.repaint(0, myDocument.getTextLength());
+ myMarkupModel.recalcEditorDimensions();
+ myMarkupModel.repaint(-1, -1);
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
index e9610b3edf8a..af3064934e2d 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
@@ -112,7 +112,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
return myMinMarkHeight;
}
- private void recalcEditorDimensions() {
+ void recalcEditorDimensions() {
EditorImpl.MyScrollBar scrollBar = myEditor.getVerticalScrollBar();
int scrollBarHeight = scrollBar.getSize().height;
@@ -751,10 +751,10 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
LOG.assertTrue(success);
}
- public void markDirtied(@NotNull ProperTextRange pos) {
- int start = Math.max(0, pos.getStartOffset() - myEditor.getLineHeight());
- int end = myEditorScrollbarTop + myEditorTargetHeight == 0 ? pos.getEndOffset() + myEditor.getLineHeight()
- : Math.min(myEditorScrollbarTop + myEditorTargetHeight, pos.getEndOffset() + myEditor.getLineHeight());
+ public void markDirtied(@NotNull ProperTextRange yPositions) {
+ int start = Math.max(0, yPositions.getStartOffset() - myEditor.getLineHeight());
+ int end = myEditorScrollbarTop + myEditorTargetHeight == 0 ? yPositions.getEndOffset() + myEditor.getLineHeight()
+ : Math.min(myEditorScrollbarTop + myEditorTargetHeight, yPositions.getEndOffset() + myEditor.getLineHeight());
ProperTextRange adj = new ProperTextRange(start, Math.max(end, start));
if (myDirtyYPositions == null) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java
index cff762ce268a..e72b7a38cbff 100644
--- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java
+++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditor.java
@@ -207,12 +207,12 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
myLeftSide.add(mySearchWrapper, BorderLayout.NORTH);
myLeftSide.add(myTree, BorderLayout.CENTER);
- myLeftSide.setMinimumSize(new Dimension(150, -1));
setLayout(new BorderLayout());
myMainSplitter = new Splitter(false);
myMainSplitter.setFirstComponent(myLeftSide);
+ myMainSplitter.setHonorComponentsMinimumSize(false);
myLoadingDecorator = new LoadingDecorator(myOwnDetails.getComponent(), this, 150);
myMainSplitter.setSecondComponent(myLoadingDecorator.getComponent());
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
index 5379d23a379f..846de538f668 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java
@@ -941,27 +941,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
private class MyComponentListener extends ComponentAdapter {
@SuppressWarnings({"RefusedBequest"})
public void componentResized(ComponentEvent e) {
- final JRootPane pane = getRootPane();
- if (pane == null) return;
- final Dimension minSize = pane.getMinimumSize();
- final Dimension size = pane.getSize();
- final Dimension winSize = getSize();
- if (minSize.width > size.width) {
- winSize.width += minSize.width - size.width;
- }
- if (minSize.height > size.height) {
- winSize.height += minSize.height - size.height;
- }
-
- if (!winSize.equals(getSize())) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- if (isShowing()) {
- setSize(winSize);
- }
- }
- });
- }
+ UIUtil.adjustWindowToMinimumSize(getWindow());
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java
index f779b2b28be4..567503997d9b 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileSystemUtil;
import com.intellij.openapi.util.io.FileUtil;
@@ -175,6 +176,8 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
private WatchRequest[] normalizeRootsForRefresh() {
if (myCachedNormalizedRequests != null) return myCachedNormalizedRequests;
List result = new ArrayList();
+
+ // No need to call for a read action here since we're only called with it on hands already.
WRITE_LOCK.lock();
try {
NextRoot:
@@ -338,37 +341,43 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
}
@Override
- public WatchRequest addRootToWatch(@NotNull String rootPath, boolean toWatchRecursively) {
+ public WatchRequest addRootToWatch(@NotNull final String rootPath, final boolean toWatchRecursively) {
if (rootPath.length() == 0 || !FileWatcher.getInstance().isOperational()) return null;
- WRITE_LOCK.lock();
- try {
- final WatchRequestImpl result = new WatchRequestImpl(rootPath, toWatchRecursively);
- boolean alreadyWatched = isAlreadyWatched(result);
- if (!alreadyWatched) {
- final VirtualFile existingFile = findFileByPathIfCached(rootPath);
- if (existingFile != null) {
- final ModalityState modalityState = ModalityState.defaultModalityState();
- RefreshQueue.getInstance().refresh(true, toWatchRecursively, null, modalityState, existingFile);
- if (existingFile.isDirectory() && !toWatchRecursively && existingFile instanceof NewVirtualFile) {
- for (VirtualFile child : ((NewVirtualFile)existingFile).getCachedChildren()) {
- RefreshQueue.getInstance().refresh(true, false, null, modalityState, child);
+ Application app = ApplicationManager.getApplication();
+ return app.runReadAction(new Computable() {
+ @Override
+ public WatchRequest compute() {
+ WRITE_LOCK.lock();
+ try {
+ final WatchRequestImpl result = new WatchRequestImpl(rootPath, toWatchRecursively);
+ boolean alreadyWatched = isAlreadyWatched(result);
+ if (!alreadyWatched) {
+ final VirtualFile existingFile = findFileByPathIfCached(rootPath);
+ if (existingFile != null) {
+ final ModalityState modalityState = ModalityState.defaultModalityState();
+ RefreshQueue.getInstance().refresh(true, toWatchRecursively, null, modalityState, existingFile);
+ if (existingFile.isDirectory() && !toWatchRecursively && existingFile instanceof NewVirtualFile) {
+ for (VirtualFile child : ((NewVirtualFile)existingFile).getCachedChildren()) {
+ RefreshQueue.getInstance().refresh(true, false, null, modalityState, child);
+ }
+ }
}
}
+ myRootsToWatch.add(result);
+ if (alreadyWatched) {
+ result.myDominated = true;
+ return result;
+ }
+ myCachedNormalizedRequests = null;
+ setUpFileWatcher();
+ return result;
+ }
+ finally {
+ WRITE_LOCK.unlock();
}
}
- myRootsToWatch.add(result);
- if (alreadyWatched) {
- result.myDominated = true;
- return result;
- }
- myCachedNormalizedRequests = null;
- setUpFileWatcher();
- return result;
- }
- finally {
- WRITE_LOCK.unlock();
- }
+ });
}
private boolean isAlreadyWatched(final WatchRequest request) {
@@ -383,33 +392,38 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
public Set addRootsToWatch(@NotNull final Collection rootPaths, final boolean toWatchRecursively) {
if (!FileWatcher.getInstance().isOperational()) return Collections.emptySet();
- Set result = new HashSet();
- Set filesToSynchronize = new HashSet();
+ final Set result = new HashSet();
+ final Set filesToSynchronize = new HashSet();
- WRITE_LOCK.lock();
- try {
- for (String rootPath : rootPaths) {
- LOG.assertTrue(rootPath != null);
- if (rootPath.length() > 0) {
- final WatchRequestImpl request = new WatchRequestImpl(rootPath, toWatchRecursively);
- final VirtualFile existingFile = findFileByPathIfCached(rootPath);
- if (existingFile != null) {
- if (!isAlreadyWatched(request)) {
- filesToSynchronize.add(existingFile);
+ Application application = ApplicationManager.getApplication();
+ application.runReadAction(new Runnable() {
+ public void run() {
+ WRITE_LOCK.lock();
+ try {
+ for (String rootPath : rootPaths) {
+ LOG.assertTrue(rootPath != null);
+ if (rootPath.length() > 0) {
+ final WatchRequestImpl request = new WatchRequestImpl(rootPath, toWatchRecursively);
+ final VirtualFile existingFile = findFileByPathIfCached(rootPath);
+ if (existingFile != null) {
+ if (!isAlreadyWatched(request)) {
+ filesToSynchronize.add(existingFile);
+ }
+ }
+ result.add(request);
+ myRootsToWatch.add(request); //add in any case, safe to add inplace without copying myRootsToWatch before the loop
}
}
- result.add(request);
- myRootsToWatch.add(request); //add in any case, safe to add inplace without copying myRootsToWatch before the loop
+ myCachedNormalizedRequests = null;
+ setUpFileWatcher();
+ }
+ finally {
+ WRITE_LOCK.unlock();
}
}
- myCachedNormalizedRequests = null;
- setUpFileWatcher();
- }
- finally {
- WRITE_LOCK.unlock();
- }
+ });
- if (!ApplicationManager.getApplication().isUnitTestMode() && !filesToSynchronize.isEmpty()) {
+ if (!application.isUnitTestMode() && !filesToSynchronize.isEmpty()) {
for (VirtualFile file : filesToSynchronize) {
if (file instanceof NewVirtualFile && file.getFileSystem() instanceof LocalFileSystem) {
((NewVirtualFile)file).markDirtyRecursively();
@@ -423,30 +437,38 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
@Override
public void removeWatchedRoot(@NotNull final WatchRequest watchRequest) {
- WRITE_LOCK.lock();
- try {
- if (myRootsToWatch.remove((WatchRequestImpl)watchRequest) && !((WatchRequestImpl)watchRequest).myDominated) {
- myCachedNormalizedRequests = null;
- setUpFileWatcher();
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ WRITE_LOCK.lock();
+ try {
+ if (myRootsToWatch.remove((WatchRequestImpl)watchRequest) && !((WatchRequestImpl)watchRequest).myDominated) {
+ myCachedNormalizedRequests = null;
+ setUpFileWatcher();
+ }
+ }
+ finally {
+ WRITE_LOCK.unlock();
+ }
}
- }
- finally {
- WRITE_LOCK.unlock();
- }
+ });
}
@Override
public void removeWatchedRoots(@NotNull final Collection rootsToWatch) {
- WRITE_LOCK.lock();
- try {
- if (myRootsToWatch.removeAll(rootsToWatch)) {
- myCachedNormalizedRequests = null;
- setUpFileWatcher();
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ WRITE_LOCK.lock();
+ try {
+ if (myRootsToWatch.removeAll(rootsToWatch)) {
+ myCachedNormalizedRequests = null;
+ setUpFileWatcher();
+ }
+ }
+ finally {
+ WRITE_LOCK.unlock();
+ }
}
- }
- finally {
- WRITE_LOCK.unlock();
- }
+ });
}
@Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
index 59028eb5373d..58b53843c80f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java
@@ -1183,7 +1183,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
button.dispose();
myId2StripeButton.remove(id);
//
- myId2FocusWatcher.remove(id);
+ ToolWindowFocusWatcher watcher = (ToolWindowFocusWatcher)myId2FocusWatcher.remove(id);
+ watcher.deinstall();
+
// Destroy decorator
final InternalDecorator decorator = getInternalDecorator(id);
decorator.dispose();
@@ -1946,11 +1948,17 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
*/
private final class ToolWindowFocusWatcher extends FocusWatcher {
private final String myId;
+ private final ToolWindowImpl myToolWindow;
private ToolWindowFocusWatcher(final ToolWindowImpl toolWindow) {
myId = toolWindow.getId();
install(toolWindow.getComponent());
+ myToolWindow = toolWindow;
+ }
+
+ public void deinstall() {
+ deinstall(myToolWindow.getComponent());
}
protected boolean isFocusedComponentChangeValid(final Component comp, final AWTEvent cause) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java
index 661617b07101..eb225e263c86 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeScreen.java
@@ -48,8 +48,6 @@ import java.awt.event.*;
import java.awt.font.FontRenderContext;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.awt.image.PixelGrabber;
import java.io.File;
import java.util.*;
import java.util.List;
@@ -164,17 +162,7 @@ public class WelcomeScreen implements Disposable {
myCaptionImage = IconLoader.getIcon(applicationInfoEx.getWelcomeScreenCaptionUrl());
myDeveloperSlogan = IconLoader.getIcon(applicationInfoEx.getWelcomeScreenDeveloperSloganUrl());
- BufferedImage image = new BufferedImage(myCaptionImage.getIconWidth(), myCaptionImage.getIconHeight(), BufferedImage.TYPE_INT_RGB);
- myCaptionImage.paintIcon(null, image.getGraphics(), 0, 0);
- final int[] pixels = new int[1];
- final PixelGrabber pixelGrabber =
- new PixelGrabber(image, myCaptionImage.getIconWidth() - 1, myCaptionImage.getIconHeight() - 2, 1, 1, pixels, 0, 1);
- try {
- pixelGrabber.grabPixels();
- myCaptionBackground = new Color(pixels[0]);
- }
- catch (InterruptedException ignore) {
- }
+ myCaptionBackground = UIUtil.getColorAt(myCaptionImage, myCaptionImage.getIconWidth() - 1, myCaptionImage.getIconHeight() - 2);
}
}
@@ -310,7 +298,9 @@ public class WelcomeScreen implements Disposable {
@Override
public void mouseEntered(MouseEvent e) {
- actionLabel.setIcon(IconLoader.getIcon("/actions/closeNew.png"));
+ if (actionLabel.getSize().width > actionLabel.getPreferredSize().width) {
+ actionLabel.setIcon(IconLoader.getIcon("/actions/closeNew.png"));
+ }
}
@Override
@@ -412,8 +402,8 @@ public class WelcomeScreen implements Disposable {
else {
final Comparator pluginsComparator = new Comparator() {
public int compare(final IdeaPluginDescriptor o1, final IdeaPluginDescriptor o2) {
- final boolean e1 = ((IdeaPluginDescriptorImpl)o1).isEnabled();
- final boolean e2 = ((IdeaPluginDescriptorImpl)o2).isEnabled();
+ final boolean e1 = o1.isEnabled();
+ final boolean e2 = o2.isEnabled();
if (e1 && !e2) return -1;
if (!e1 && e2) return 1;
return o1.getName().toLowerCase().compareTo(o2.getName().toLowerCase());
@@ -586,7 +576,7 @@ public class WelcomeScreen implements Disposable {
if (r.getWidth() > maxWidth) {
- StringBuffer prefix = new StringBuffer();
+ StringBuilder prefix = new StringBuilder();
String suffix = string;
int maxIdxPerLine = (int)(maxWidth / r.getWidth() * string.length());
int lengthLeft = string.length();
diff --git a/platform/platform-impl/src/com/intellij/ui/AbstractTitledSeparatorWithIcon.java b/platform/platform-impl/src/com/intellij/ui/AbstractTitledSeparatorWithIcon.java
index 7293e1289a47..5a061dfef07a 100644
--- a/platform/platform-impl/src/com/intellij/ui/AbstractTitledSeparatorWithIcon.java
+++ b/platform/platform-impl/src/com/intellij/ui/AbstractTitledSeparatorWithIcon.java
@@ -114,6 +114,15 @@ public abstract class AbstractTitledSeparatorWithIcon extends JPanel {
onImpl();
}
+ public void initOn() {
+ initDetails();
+ myOn = true;
+ myLabel.setIcon(myIconOpen);
+ initOnImpl();
+ }
+
+ protected abstract void initOnImpl();
+
public void off() {
myOn = false;
myLabel.setIcon(myIcon);
diff --git a/platform/platform-impl/src/com/intellij/ui/SplitterWithSecondHideable.java b/platform/platform-impl/src/com/intellij/ui/SplitterWithSecondHideable.java
index 880060b2b868..2b86c4af99a6 100644
--- a/platform/platform-impl/src/com/intellij/ui/SplitterWithSecondHideable.java
+++ b/platform/platform-impl/src/com/intellij/ui/SplitterWithSecondHideable.java
@@ -15,6 +15,7 @@
*/
package com.intellij.ui;
+import com.intellij.openapi.ui.PseudoSplitter;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vcs.changes.RefreshablePanel;
@@ -35,7 +36,7 @@ import java.awt.event.MouseWheelEvent;
* Time: 2:33 PM
*/
public abstract class SplitterWithSecondHideable {
- private final Splitter mySplitter;
+ private final PseudoSplitter mySplitter;
private final AbstractTitledSeparatorWithIcon myTitledSeparator;
private final boolean myVertical;
private final OnOffListener myListener;
@@ -67,14 +68,32 @@ public abstract class SplitterWithSecondHideable {
}
@Override
- protected void onImpl() {
- final int firstSize = vertical ? mySplitter.getFirstComponent().getHeight() : mySplitter.getFirstComponent().getWidth();
+ protected void initOnImpl() {
final float proportion = myPreviousProportion > 0 ? myPreviousProportion : getSplitterInitialProportion();
- mySplitter.setProportion(proportion);
+ mySplitter.setSecondComponent(myDetailsComponent.getPanel());
+ mySuperDivider.setResizeEnabled(true);
+
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ mySplitter.fixFirst(proportion);
+ mySplitter.revalidate();
+ mySplitter.repaint();
+ }
+ });
+ }
+
+ @Override
+ protected void onImpl() {
+ final float proportion = myPreviousProportion > 0 ? myPreviousProportion : getSplitterInitialProportion();
+ final int firstSize = vertical ? mySplitter.getFirstComponent().getHeight() : mySplitter.getFirstComponent().getWidth();
+ // !! order is important! first fix
+ mySplitter.fixFirst();
+ myListener.on((int) ((1 - proportion) * firstSize / proportion));
+ //mySplitter.setProportion(proportion);
mySplitter.setSecondComponent(myDetailsComponent.getPanel());
mySplitter.revalidate();
mySplitter.repaint();
- myListener.on((int) ((1 - proportion) * firstSize / proportion));
mySuperDivider.setResizeEnabled(true);
}
@@ -83,6 +102,7 @@ public abstract class SplitterWithSecondHideable {
final int previousSize = vertical ? mySplitter.getSecondComponent().getHeight() : mySplitter.getSecondComponent().getWidth();
mySplitter.setSecondComponent(myFictivePanel);
myPreviousProportion = mySplitter.getProportion();
+ mySplitter.freeAll();
mySplitter.setProportion(1.0f);
mySplitter.revalidate();
mySplitter.repaint();
@@ -90,7 +110,7 @@ public abstract class SplitterWithSecondHideable {
mySuperDivider.setResizeEnabled(false);
}
};
- mySplitter = new Splitter(vertical) {
+ mySplitter = new PseudoSplitter(vertical) {
{
myTitledSeparator.mySeparator.addMouseListener(new MouseAdapter() {
@Override
@@ -200,6 +220,10 @@ public abstract class SplitterWithSecondHideable {
public float getUsedProportion() {
return isOn() ? mySplitter.getProportion() : myPreviousProportion;
}
+
+ public void initOn() {
+ myTitledSeparator.initOn();
+ }
public void on() {
myTitledSeparator.on();
diff --git a/platform/platform-main/src/com/intellij/idea/MainImpl.java b/platform/platform-main/src/com/intellij/idea/MainImpl.java
index 966c9da3f515..bd1dfa8060df 100644
--- a/platform/platform-main/src/com/intellij/idea/MainImpl.java
+++ b/platform/platform-main/src/com/intellij/idea/MainImpl.java
@@ -15,11 +15,15 @@
*/
package com.intellij.idea;
+import com.intellij.openapi.application.ApplicationInfo;
+import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.application.ConfigImportHelper;
import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.AppUIUtil;
+import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
@@ -63,10 +67,17 @@ public class MainImpl {
Runtime.getRuntime().addShutdownHook(new Thread("Shutdown hook - logging") {
public void run() {
LOG.info(
- "------------------------------------------------------ IDEA SHUTDOWN ------------------------------------------------------");
+ "------------------------------------------------------ IDE SHUTDOWN ------------------------------------------------------");
}
});
- LOG.info("------------------------------------------------------ IDEA STARTED ------------------------------------------------------");
+ LOG.info("------------------------------------------------------ IDE STARTED ------------------------------------------------------");
+
+ final ApplicationInfo appInfo = ApplicationInfoImpl.getShadowInstance();
+ final ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
+ LOG.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild() + ", " +
+ DateFormatUtil.formatBuildDate(appInfo.getBuildDate()) + ")");
+ LOG.info("JRE: " + System.getProperty("java.runtime.version", "-") + " (" + System.getProperty("java.vendor", "-") + ")");
+ LOG.info("JVM: " + System.getProperty("java.vm.version", "-") + " (" + System.getProperty("java.vm.vendor", "-") + ")");
_main(args);
}
diff --git a/platform/platform-resources-en/src/messages/ProjectBundle.properties b/platform/platform-resources-en/src/messages/ProjectBundle.properties
index 2133db0e581e..ab1c4ae0ee85 100644
--- a/platform/platform-resources-en/src/messages/ProjectBundle.properties
+++ b/platform/platform-resources-en/src/messages/ProjectBundle.properties
@@ -316,7 +316,7 @@ project.roots.tooltip.library.has.broken.paths=Library ''{0}'' has broken {1, ch
project.roots.error.message.invalid.roots=invalid {0} {1, choice, 1#root|2#roots}
choose.modules.dialog.title=Choose Modules
choose.modules.dialog.description=Library ''{0}'' will be added to the selected modules.
-project.roots.javadoc.tab.description=Manage external JavaDocs attached to this module. External JavaDoc override JavaDoc annotations you might have in your module.
+project.roots.javadoc.tab.description=Manage external JavaDocs attached to this module. External JavaDoc override JavaDoc annotations you might have in your module.
project.roots.output.compiler.title=Compiler output
project.roots.module.jdk.problem.message=Module SDK is not defined.
project.roots.module.duplicate.name.message=duplicate module name
@@ -338,7 +338,7 @@ external.annotations.suggestion.message=If you do not want annotatio
sdk.configure.annotations.tab=Annotations
project.roots.path.tab.title=Paths
project.roots.external.annotations.tab.title=External Annotations
-project.roots.external.annotations.description=Manage external annotations attached to this module.
+project.roots.external.annotations.description=Manage external annotations attached to this module.
add.external.annotations.path.title=Add path to external annotations
add.external.annotations.path.description=Select path in which external annotations for module sources is located
diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties
index 3dd265f62fcb..8eb94ba4ebdd 100644
--- a/platform/platform-resources-en/src/misc/registry.properties
+++ b/platform/platform-resources-en/src/misc/registry.properties
@@ -152,7 +152,10 @@ dir.diff.default.src.folder=
dir.diff.default.trg.folder=
show.live.templates.in.completion=false
documentation.component.editor.font=false
+
ide.mac.useNativeClipboard=true
+ide.mac.useNativeClipboard.async=false
+
show.all.classes.on.first.completion=false
limited.relevance.sorting.in.completion=false
limited.relevance.sorting.in.completion.description=Whether only 5 most relevant items are shown at the top of the completion list, or it's sorted by relevance completely
@@ -166,4 +169,4 @@ show.anonymous.in.structure.view=false
show.anonymous.in.structure.view.description=Enables Java anonymous classes in Structure View
enable.groovy.hotswap=true
-enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process which allows to hot-swap Groovy changes in some cases
\ No newline at end of file
+enable.groovy.hotswap.description=Whether IDEA should add a special java agent to the debugged process which allows to hot-swap Groovy changes in some cases
diff --git a/platform/platform-resources-en/src/tips/GoToAction.html b/platform/platform-resources-en/src/tips/GoToAction.html
index 1938ed5092af..89a93e95e3f2 100644
--- a/platform/platform-resources-en/src/tips/GoToAction.html
+++ b/platform/platform-resources-en/src/tips/GoToAction.html
@@ -7,7 +7,7 @@
To quickly find a menu command or toolbar action, you do not need to look through the menus. Just press
&shortcut:GotoAction;
- (Go To | Action on the main
+ (Help | Find Action on the main
menu) and start typing the name of the action. Choose the desired action from the suggestion list.
diff --git a/platform/platform-resources-en/src/tips/GoToClass.html b/platform/platform-resources-en/src/tips/GoToClass.html
index 65217d1789cc..93b6adf80036 100644
--- a/platform/platform-resources-en/src/tips/GoToClass.html
+++ b/platform/platform-resources-en/src/tips/GoToClass.html
@@ -5,12 +5,12 @@
To open any class in the editor quickly, press &shortcut:GotoClass;
- (Go To | Class)
+ (Navigate | Class)
and start typing the name of the class. Choose the class from a drop-down list that appears.

You can open any file in your project in a similar way by using &shortcut:GotoFile;
- (Go To | File)
+ (Navigate | File)
diff --git a/platform/platform-resources-en/src/tips/GoToInspection.html b/platform/platform-resources-en/src/tips/GoToInspection.html
index d91dae04fb2e..dabb6ef4fb51 100644
--- a/platform/platform-resources-en/src/tips/GoToInspection.html
+++ b/platform/platform-resources-en/src/tips/GoToInspection.html
@@ -5,11 +5,10 @@
- To quickly find and run an inspection press
+
To quickly find and run an inspection, press
&shortcut:RunInspection;
- (Go To | Inspection on the main
- menu) and start typing the name of the inspection or its group. Choose the desired inspection from the suggestion list and
- then select a desired scope.
+ and start typing the name of the inspection or its group. Choose the desired inspection from the suggestion list and
+ then specify the desired scope.
diff --git a/platform/platform-resources-en/src/tips/GoToSymbol.html b/platform/platform-resources-en/src/tips/GoToSymbol.html
index 841a9cfa37d0..8a4cd3e47d41 100644
--- a/platform/platform-resources-en/src/tips/GoToSymbol.html
+++ b/platform/platform-resources-en/src/tips/GoToSymbol.html
@@ -6,7 +6,7 @@
To open any particular method or field in the editor quickly, press &shortcut:GotoSymbol;
- (Go To | Symbol)
+ (Navigate | Symbol)
and start typing its name.
Choose the symbol from a drop-down list that appears.

diff --git a/platform/platform-resources-en/src/tips/GotoLineInFile.html b/platform/platform-resources-en/src/tips/GotoLineInFile.html
index cafe6b6ef6f4..cc44b74064f1 100644
--- a/platform/platform-resources-en/src/tips/GotoLineInFile.html
+++ b/platform/platform-resources-en/src/tips/GotoLineInFile.html
@@ -5,7 +5,7 @@
To open any class or file in the editor at the desired line, press &shortcut:GotoFile;
- (Go To | File),
+ (Navigate | File),
start typing the name, and choose the one from the suggestion list.
Then type the colon (:) and a line number.
diff --git a/platform/platform-resources-en/src/tips/HighlightUsagesInFile.html b/platform/platform-resources-en/src/tips/HighlightUsagesInFile.html
index a205f86760b9..d99b48cb00e8 100644
--- a/platform/platform-resources-en/src/tips/HighlightUsagesInFile.html
+++ b/platform/platform-resources-en/src/tips/HighlightUsagesInFile.html
@@ -5,7 +5,7 @@
- Use &shortcut:HighlightUsagesInFile; (Search | Highlight Usages in File)
+
Use &shortcut:HighlightUsagesInFile; (Edit | Find | Highlight Usages in File)
to quickly highlight usages of some variable in the current file.
Use &shortcut:FindNext; and &shortcut:FindPrevious; keys to navigate through highlighted usages.
Press &shortcut:EditorEscape; to remove the highlighting.
diff --git a/platform/platform-resources-en/src/tips/JumpToLastEdit.html b/platform/platform-resources-en/src/tips/JumpToLastEdit.html
index 6e570e7d708e..1438812f4e1d 100644
--- a/platform/platform-resources-en/src/tips/JumpToLastEdit.html
+++ b/platform/platform-resources-en/src/tips/JumpToLastEdit.html
@@ -5,7 +5,7 @@
- &shortcut:JumpToLastChange; (Go To | Last Edit Location)
+
&shortcut:JumpToLastChange; (Navigate | Last Edit Location)
brings you back to the last place where you made changes in the code.
Pressing &shortcut:JumpToLastChange; a few times moves you deeper into your changes history.
diff --git a/platform/platform-resources-en/src/tips/QuickJavaDocInLookups.html b/platform/platform-resources-en/src/tips/QuickJavaDocInLookups.html
index 5ba036c05010..6d06b6283e7f 100644
--- a/platform/platform-resources-en/src/tips/QuickJavaDocInLookups.html
+++ b/platform/platform-resources-en/src/tips/QuickJavaDocInLookups.html
@@ -8,7 +8,7 @@
The shortcuts such as &shortcut:QuickJavaDoc;
(View | Quick Documentation),
&shortcut:ParameterInfo; (View | Parameter Info),
- &shortcut:GotoDeclaration; (Go To | Declaration)
+ &shortcut:GotoDeclaration; (Navigate | Declaration)
and others can be used not only in the editor but in the code completion popup list as well.

diff --git a/platform/platform-resources-en/src/tips/ShowUsages.html b/platform/platform-resources-en/src/tips/ShowUsages.html
index b7104d24bbe0..83e009ffab12 100644
--- a/platform/platform-resources-en/src/tips/ShowUsages.html
+++ b/platform/platform-resources-en/src/tips/ShowUsages.html
@@ -7,7 +7,7 @@
You can bring forward the list of all usages of a class, method or variable across the whole
project, and quickly jump to the selected usage. To do that, place the caret at the symbol's name or at its usage
- in code and press &shortcut:ShowUsages; (Search | Show Usages
+ in code and press &shortcut:ShowUsages; (Edit | Find | Show Usages
in the main menu), scroll the list and click the desired usage.

diff --git a/platform/platform-resources-en/src/tips/WildcardsInNavigationPopups.html b/platform/platform-resources-en/src/tips/WildcardsInNavigationPopups.html
index 56786c9ddaf5..35b613eff122 100644
--- a/platform/platform-resources-en/src/tips/WildcardsInNavigationPopups.html
+++ b/platform/platform-resources-en/src/tips/WildcardsInNavigationPopups.html
@@ -7,8 +7,8 @@
For the pattern search in the Go to Class,
Go to Symbol and
- Go to File popups,
- you can use * and space symbols.
+ Go to File pop-up frames,
+ use * and space symbols.
* stands for any symbol.
Space at the end means the end of a pattern, and the preceding string will be considered not just a prefix but a whole pattern.
The list of the suggested names will be reduced accordingly.
diff --git a/platform/util/src/com/intellij/openapi/ui/PseudoSplitter.java b/platform/util/src/com/intellij/openapi/ui/PseudoSplitter.java
new file mode 100644
index 000000000000..34debeed1858
--- /dev/null
+++ b/platform/util/src/com/intellij/openapi/ui/PseudoSplitter.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.ui;
+
+import javax.swing.*;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Irina.Chernushina
+ * Date: 12/3/11
+ * Time: 6:13 PM
+ */
+public class PseudoSplitter extends Splitter {
+ private boolean myFirstIsFixed;
+ private boolean mySecondIsFixed;
+ private int myFirstFixedSize;
+ private int mySecondFixedSize;
+
+ public PseudoSplitter(boolean vertical) {
+ super(vertical);
+ myFirstIsFixed = false;
+ mySecondIsFixed = false;
+ }
+
+ public PseudoSplitter(boolean vertical, float proportion) {
+ super(vertical, proportion);
+ myFirstIsFixed = true;
+ }
+
+ public PseudoSplitter(boolean vertical, float proportion, float minProp, float maxProp) {
+ super(vertical, proportion, minProp, maxProp);
+ myFirstIsFixed = true;
+ }
+
+ private int getSizeForComp(final JComponent component) {
+ return getOrientation() ? component.getHeight() : component.getWidth();
+ }
+
+ public void fixFirst(final float proportion) {
+ assert getFirstComponent() != null;
+ int comp = getSizeForComp(this);
+ myFirstFixedSize = (int)(comp * proportion);
+ myFirstIsFixed = true;
+ mySecondIsFixed = false;
+ }
+
+ public void fixFirst() {
+ assert getFirstComponent() != null;
+ myFirstFixedSize = getSizeForComp(getFirstComponent());
+ myFirstIsFixed = true;
+ mySecondIsFixed = false;
+ }
+
+ public void fixSecond() {
+ assert getSecondComponent() != null;
+ mySecondFixedSize = getSizeForComp(getSecondComponent());
+ myFirstIsFixed = false;
+ mySecondIsFixed = true;
+ }
+
+ public void freeAll() {
+ myFirstIsFixed = false;
+ mySecondIsFixed = false;
+ }
+
+ @Override
+ public void doLayout() {
+ int total = getSizeForComp(this);
+ if (myFirstIsFixed) {
+ myProportion = ((float)myFirstFixedSize) / (total - getDividerWidth());
+ } else if (mySecondIsFixed) {
+ myProportion = ((float)total - mySecondFixedSize) / (total - getDividerWidth());
+ }
+ super.doLayout();
+ }
+
+ @Override
+ public void setProportion(float proportion) {
+ boolean firstIsFixed = myFirstIsFixed;
+ boolean secondIsFixed = mySecondIsFixed;
+ myFirstIsFixed = false;
+ mySecondIsFixed = false;
+ super.setProportion(proportion);
+
+ int total = getSizeForComp(this);
+ if (firstIsFixed) {
+ myFirstFixedSize = (int) (myProportion * (total - getDividerWidth()));
+ myFirstIsFixed = true;
+ } else if (secondIsFixed) {
+ mySecondFixedSize = (int) ((1 - myProportion) * (total - getDividerWidth()));
+ mySecondIsFixed = true;
+ }
+ }
+}
diff --git a/platform/util/src/com/intellij/openapi/ui/Splitter.java b/platform/util/src/com/intellij/openapi/ui/Splitter.java
index 1aac8335f09a..bfd632013c1a 100644
--- a/platform/util/src/com/intellij/openapi/ui/Splitter.java
+++ b/platform/util/src/com/intellij/openapi/ui/Splitter.java
@@ -53,7 +53,7 @@ public class Splitter extends JPanel {
private final float myMaxProp;
- private float myProportion;
+ protected float myProportion;
private final Divider myDivider;
private JComponent mySecondComponent;
diff --git a/platform/util/src/com/intellij/util/text/DateFormatUtil.java b/platform/util/src/com/intellij/util/text/DateFormatUtil.java
index 1ba2b7ca3d10..1b4fd217a55c 100644
--- a/platform/util/src/com/intellij/util/text/DateFormatUtil.java
+++ b/platform/util/src/com/intellij/util/text/DateFormatUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
+import java.util.Locale;
public class DateFormatUtil {
private static final Logger LOG = Logger.getInstance("com.intellij.util.text.DateFormatUtil");
@@ -38,6 +39,10 @@ public class DateFormatUtil {
private static final SyncDateFormat TIME_WITH_SECONDS_FORMAT = getFormat(DateFormat.MEDIUM, DateType.TIME);
private static final SyncDateFormat DATE_TIME_FORMAT = getFormat(DateFormat.SHORT, DateType.DATETIME);
+ // fixed formats - should be locale-independent
+ private static final SimpleDateFormat BUILD_DATE_FORMAT = new SimpleDateFormat("dd MMM yyyy HH:ss", Locale.US);
+ private static final DateFormat ABOUT_DATE_FORMAT = DateFormat.getDateInstance(DateFormat.LONG, Locale.US);
+
public static final long SECOND = 1000;
public static final long MINUTE = SECOND * 60;
public static final long HOUR = MINUTE * 60;
@@ -464,4 +469,14 @@ public class DateFormatUtil {
private static final int MacFormatterLongStyle = 3;
private static final int MacFormatterFullStyle = 4;
private static final int MacFormatterBehavior_10_4 = 1040;
+
+ @NotNull
+ public static String formatBuildDate(@NotNull Calendar cal) {
+ return BUILD_DATE_FORMAT.format(cal.getTime());
+ }
+
+ @NotNull
+ public static String formatAboutDialogDate(@NotNull Date date) {
+ return ABOUT_DATE_FORMAT.format(date);
+ }
}
\ No newline at end of file
diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java
index 2d9f73b9fcf9..af1493d52a01 100644
--- a/platform/util/src/com/intellij/util/ui/UIUtil.java
+++ b/platform/util/src/com/intellij/util/ui/UIUtil.java
@@ -55,6 +55,7 @@ import java.awt.*;
import java.awt.event.*;
import java.awt.font.FontRenderContext;
import java.awt.image.BufferedImage;
+import java.awt.image.PixelGrabber;
import java.beans.PropertyChangeListener;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
@@ -2555,5 +2556,38 @@ public class UIUtil {
return ans;
}
+
+ public static void adjustWindowToMinimumSize(final Window window) {
+ if (window == null) return;
+ final Dimension minSize = window.getMinimumSize();
+ final Dimension size = window.getSize();
+ final Dimension newSize = new Dimension(Math.max(size.width, minSize.width), Math.max(size.height, minSize.height));
+
+ if (!newSize.equals(size)) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ if (window.isShowing()) {
+ window.setSize(newSize);
+ }
+ }
+ });
+ }
+ }
+
+ @Nullable
+ public static Color getColorAt(final Icon icon, final int x, final int y) {
+ BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
+ icon.paintIcon(null, image.getGraphics(), 0, 0);
+ final int[] pixels = new int[1];
+ final PixelGrabber pixelGrabber =
+ new PixelGrabber(image, x, y, 1, 1, pixels, 0, 1);
+ try {
+ pixelGrabber.grabPixels();
+ return new Color(pixels[0]);
+ }
+ catch (InterruptedException ignore) {
+ }
+ return null;
+ }
}
diff --git a/platform/util/testSrc/com/intellij/util/text/DateFormatUtilTest.java b/platform/util/testSrc/com/intellij/util/text/DateFormatUtilTest.java
index 3756fdeab891..aa40d77c244c 100644
--- a/platform/util/testSrc/com/intellij/util/text/DateFormatUtilTest.java
+++ b/platform/util/testSrc/com/intellij/util/text/DateFormatUtilTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.GregorianCalendar;
public class DateFormatUtilTest extends TestCase {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy hh.mm.ss");
@@ -70,16 +71,20 @@ public class DateFormatUtilTest extends TestCase {
doTestDateTime("Yesterday " + DateFormatUtil.formatTime(DATE_FORMAT.parse("31.12.2003 15.00.00")), "31.12.2003 15.00.00");
}
- private void doTestPrettyDate(String expected, String date) throws ParseException {
+ private static void doTestPrettyDate(String expected, String date) throws ParseException {
assertEquals(expected, DateFormatUtil.formatPrettyDate(DATE_FORMAT.parse(date)));
}
- private void doTestDateTime(String expected, String date) throws ParseException {
+ private static void doTestDateTime(String expected, String date) throws ParseException {
assertEquals(expected, DateFormatUtil.formatPrettyDateTime(DATE_FORMAT.parse(date)));
}
+ private static Date date(final int year, final int month, final int day, final int hour, final int minute, final int second) {
+ return new GregorianCalendar(year, month - 1, day, hour, minute, second).getTime();
+ }
+
public void testConvertingMacToJavaPattern() throws Throwable {
- Clock.setTime(new Date(2004 - 1900, 1, 5, 16, 6, 7).getTime() + 8);
+ Clock.setTime(date(2004, 2, 5, 16, 6, 7).getTime() + 8);
String mon = new SimpleDateFormat("MMM").format(Clock.getTime());
String month = new SimpleDateFormat("MMMMM").format(Clock.getTime());
@@ -110,7 +115,7 @@ public class DateFormatUtilTest extends TestCase {
assertConvertedFormat("%", "");
}
- private void assertConvertedFormat(String pattern, String expected) throws Throwable {
+ private static void assertConvertedFormat(String pattern, String expected) throws Throwable {
String converted = DateFormatUtil.convertMacPattern(pattern);
try {
assertEquals(expected, new SimpleDateFormat(converted).format(Clock.getTime()));
@@ -121,7 +126,7 @@ public class DateFormatUtilTest extends TestCase {
}
}
- private void assertConvertedFormatMatches(String pattern, String expectedPattern) throws Throwable {
+ private static void assertConvertedFormatMatches(String pattern, String expectedPattern) throws Throwable {
String converted = DateFormatUtil.convertMacPattern(pattern);
try {
String actual = new SimpleDateFormat(converted).format(Clock.getTime());
@@ -132,4 +137,11 @@ public class DateFormatUtilTest extends TestCase {
throw e;
}
}
+
+ public void testAboutDialogDataFormatter() throws Exception {
+ assertEquals("December 12, 2012",
+ DateFormatUtil.formatAboutDialogDate(date(2012, 12, 12, 15, 35, 12)));
+ assertEquals("January 1, 1999",
+ DateFormatUtil.formatAboutDialogDate(date(1999, 1, 1, 0, 0, 0)));
+ }
}
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/VcsVirtualFile.java b/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/VcsVirtualFile.java
index a0ae2a47cb52..4a1953f02f4c 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/VcsVirtualFile.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/vfs/VcsVirtualFile.java
@@ -21,7 +21,9 @@ import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.VcsException;
+import com.intellij.openapi.vcs.history.ShortVcsRevisionNumber;
import com.intellij.openapi.vcs.history.VcsFileRevision;
+import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.util.ArrayUtil;
@@ -76,7 +78,13 @@ public class VcsVirtualFile extends AbstractVcsVirtualFile {
fireBeforeContentsChange();
myModificationStamp++;
- setRevision(myFileRevision.getRevisionNumber().asString());
+ final VcsRevisionNumber revisionNumber = myFileRevision.getRevisionNumber();
+ if (revisionNumber instanceof ShortVcsRevisionNumber) {
+ setRevision(((ShortVcsRevisionNumber) revisionNumber).toShortString());
+ }
+ else {
+ setRevision(revisionNumber.asString());
+ }
myContent = myFileRevision.getContent();
myCharset = new CharsetToolkit(myContent).guessEncoding(myContent.length);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java
index c27716f62009..6b82dc03f532 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java
@@ -313,7 +313,6 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myView);
final JPanel wrapper = new JPanel(new BorderLayout());
wrapper.add(scrollPane, BorderLayout.CENTER);
- mySplitter.setShowDividerControls(true);
mySplitter.setFirstComponent(wrapper);
content.add(mySplitter, BorderLayout.CENTER);
content.add(myProgressLabel, BorderLayout.SOUTH);
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShortDiffDetails.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShortDiffDetails.java
index 7dbf8370e7f9..b65831f7b667 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShortDiffDetails.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ShortDiffDetails.java
@@ -197,7 +197,9 @@ public class ShortDiffDetails implements RefreshablePanel, Disposable {
@Override
public void dispose() {
- myDetailsLoader.dispose();
+ if (myDetailsLoader != null) {
+ myDetailsLoader.dispose();
+ }
myDetailsPanel.clear();
myDetailsCache.clear();
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java
index f3765c2b727b..ded368b51aae 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchCommitExecutor.java
@@ -32,6 +32,7 @@ import com.intellij.openapi.util.DefaultJDOMExternalizer;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager;
@@ -70,7 +71,7 @@ public class CreatePatchCommitExecutor implements CommitExecutorWithHelp, Projec
@Nls
public String getActionText() {
- return VcsBundle.message("create.patch.commit.action.text");
+ return VcsBundle.message("create.patch.commit.action.title");
}
@Override
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesAction.java
index c4b37c443f04..b9a1702e25d0 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesAction.java
@@ -141,7 +141,7 @@ public class DiffShelvedChangesAction extends AnAction implements DumbAware {
VcsBalloonProblemNotifier.showOverChangesView(project, "Show Diff: Cannot find base for: " + StringUtil.join(missing, ",\n"), MessageType.WARNING);
}
- ShowDiffAction.showDiffImpl(project, diffRequestPresentables, toSelectIdx, new ShowDiffUIContext(false));
+ ShowDiffAction.showDiffImpl(project, diffRequestPresentables, toSelectIdx, new ShowDiffUIContext(true));
}
private static class PatchesPreloader {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListViewerDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListViewerDialog.java
index 57515ce1d6b7..dfd29fc13cd6 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListViewerDialog.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangeListViewerDialog.java
@@ -165,7 +165,6 @@ public class ChangeListViewerDialog extends DialogWrapper implements DataProvide
commitPanel.add(commitMessageScroll, BorderLayout.CENTER);
splitter.setSecondComponent(commitPanel);
- splitter.setShowDividerControls(true);
}
mainPanel.add(splitter, BorderLayout.CENTER);
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
index d81ac648695c..fb5976f0501c 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java
@@ -46,7 +46,6 @@ import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.SplitterWithSecondHideable;
import com.intellij.util.Alarm;
import com.intellij.util.OnOffListener;
-import com.intellij.util.ui.AdjustComponentWhenShown;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -54,7 +53,6 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
-import java.awt.font.LineMetrics;
import java.io.File;
import java.util.*;
import java.util.List;
@@ -83,7 +81,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
private final Alarm myOKButtonUpdateAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private String myLastKnownComment = "";
private final boolean myAllOfDefaultChangeListChangesIncluded;
- @NonNls private static final String SPLITTER_PROPORTION_OPTION = "CommitChangeListDialog.SPLITTER_PROPORTION";
+ @NonNls private static final String SPLITTER_PROPORTION_OPTION = "CommitChangeListDialog.SPLITTER_PROPORTION_";
private final Action[] myExecutorActions;
private final boolean myShowVcsCommit;
private final Map myPerVcsOptionsPanels = new HashMap();
@@ -104,12 +102,13 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
private String myHelpId;
private SplitterWithSecondHideable myDetailsSplitter;
- private static final String DETAILS_SPLITTER_PROPORTION_OPTION = "CommitChangeListDialog.DETAILS_SPLITTER_PROPORTION_OPTION";
- private static final String DETAILS_SHOW_OPTION = "CommitChangeListDialog.DETAILS_SHOW_OPTION";
+ private static final String DETAILS_SPLITTER_PROPORTION_OPTION = "CommitChangeListDialog.DETAILS_SPLITTER_PROPORTION_OPTION_";
+ private static final String DETAILS_SHOW_OPTION = "CommitChangeListDialog.DETAILS_SHOW_OPTION_";
private JPanel myDetailsPanel;
- private final AdjustComponentWhenShown myAdjustWhenShown;
private final FileAndDocumentListenersForShortDiff myListenersForShortDiff;
private String myOkActionText;
+ private final ZipperUpdater myZipperUpdater;
+ private final Runnable myRefreshDetails;
private static class MyUpdateButtonsRunnable implements Runnable {
private CommitChangeListDialog myDialog;
@@ -275,8 +274,8 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
myBrowserExtender = browser.getExtender();
}
myDiffDetails.setParent(myBrowser);
- final ZipperUpdater zipperUpdater = new ZipperUpdater(30, Alarm.ThreadToUse.SWING_THREAD, getDisposable());
- final Runnable refreshShortDiffDetails = new Runnable() {
+ myZipperUpdater = new ZipperUpdater(30, Alarm.ThreadToUse.SWING_THREAD, getDisposable());
+ myRefreshDetails = new Runnable() {
@Override
public void run() {
myDiffDetails.refresh();
@@ -285,7 +284,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
myListenersForShortDiff = new FileAndDocumentListenersForShortDiff(myDiffDetails) {
@Override
protected void updateDetails() {
- zipperUpdater.queue(refreshShortDiffDetails);
+ myZipperUpdater.queue(myRefreshDetails);
}
@Override
protected boolean updateSynchronously() {
@@ -297,7 +296,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
myBrowser.getViewer().addSelectionListener(new Runnable() {
@Override
public void run() {
- zipperUpdater.queue(refreshShortDiffDetails);
+ myZipperUpdater.queue(myRefreshDetails);
}
});
@@ -468,21 +467,23 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
support.installSearch(myCommitMessageArea.getEditorField(), myCommitMessageArea.getEditorField());
}
- myAdjustWhenShown = new AdjustComponentWhenShown() {
- @Override
- protected boolean init() {
- myDiffDetails.refresh();
- String value = PropertiesComponent.getInstance().getValue(DETAILS_SHOW_OPTION);
- if (value != null) {
- Boolean asBoolean = Boolean.valueOf(value);
- if (Boolean.TRUE.equals(asBoolean)) {
- myDetailsSplitter.on();
- }
- }
- return calcSplitterProportion();
+ showDetailsIfSaved();
+ }
+
+ private void showDetailsIfSaved() {
+ String value = PropertiesComponent.getInstance().getValue(DETAILS_SHOW_OPTION);
+ if (value != null) {
+ Boolean asBoolean = Boolean.valueOf(value);
+ if (Boolean.TRUE.equals(asBoolean)) {
+ myDetailsSplitter.initOn();
}
- };
- myAdjustWhenShown.install(myBrowser);
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ myZipperUpdater.queue(myRefreshDetails);
+ }
+ });
}
private void updateOnListSelection() {
@@ -938,6 +939,8 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
mySplitter.setFirstComponent(myBrowser);
mySplitter.setSecondComponent(myCommitMessageArea);
mySplitter.setDividerWidth(3);
+ initMainSplitter();
+
rootPane.add(mySplitter, BorderLayout.CENTER);
JComponent browserHeader = myBrowser.getHeaderPanel();
@@ -968,7 +971,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
new OnOffListener() {
@Override
public void on(Integer integer) {
- if (! myAdjustWhenShown.isAdjusted()) return;
+ if (integer == 0) return;
final Dimension dialogSize = getSize();
setSize(dialogSize.width, dialogSize.height + integer);
repaint();
@@ -976,7 +979,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
@Override
public void off(Integer integer) {
- if (! myAdjustWhenShown.isAdjusted()) return;
+ if (integer == 0) return;
final Dimension dialogSize = getSize();
setSize(dialogSize.width, dialogSize.height - integer);
repaint();
@@ -1000,7 +1003,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}
}
if (value <= 0.05 || value >= 0.95) {
- return 0.7f;
+ return 0.6f;
}
return value;
}
@@ -1009,30 +1012,23 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return myDetailsSplitter.getComponent();
}
- private void initDetails() {
- if (myDetailsPanel == null) {
- myDetailsPanel = myDiffDetails.getPanel();
- //myDetailsPanel.setBorder(BorderFactory.createLineBorder(UIUtil.getBorderColor()));
- }
- }
-
- private boolean calcSplitterProportion() {
+ private void initMainSplitter() {
final String s = PropertiesComponent.getInstance().getValue(SPLITTER_PROPORTION_OPTION);
if (s != null) {
try {
mySplitter.setProportion(Float.valueOf(s).floatValue());
- return true;
} catch (NumberFormatException e) {
//
}
+ } else {
+ mySplitter.setProportion(0.8f);
+ }
+ }
+
+ private void initDetails() {
+ if (myDetailsPanel == null) {
+ myDetailsPanel = myDiffDetails.getPanel();
}
- int height = mySplitter.getHeight();
- if (height == 0) return false;
- Graphics g = myCommitMessageArea.getEditorField().getGraphics();
- final LineMetrics lm = g.getFont().getLineMetrics("Wp", g.getFontMetrics().getFontRenderContext());
- final float commentHeight = 8 * lm.getHeight();
- mySplitter.setProportion((height - commentHeight)/height);
- return true;
}
public Collection getAffectedVcses() {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java
index 3bcfd4a6f6d0..27beb9ccae27 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java
@@ -77,6 +77,7 @@ public class LineStatusTracker {
private boolean myAnathemaThrown;
private FileEditorManager myFileEditorManager;
private final VirtualFile myVirtualFile;
+ private volatile boolean myReleased;
private LineStatusTracker(final Document document, final Document upToDateDocument, final Project project, final VirtualFile virtualFile) {
myVirtualFile = virtualFile;
@@ -89,10 +90,12 @@ public class LineStatusTracker {
myRanges = new ArrayList();
myAnathemaThrown = false;
myFileEditorManager = FileEditorManager.getInstance(myProject);
+ myReleased = false;
}
public void initialize(@NotNull final String upToDateContent, @NotNull RevisionPack baseRevisionNumber) {
ApplicationManager.getApplication().assertIsDispatchThread();
+ if (myReleased) return;
synchronized (myLock) {
try {
@@ -166,6 +169,7 @@ public class LineStatusTracker {
@SuppressWarnings({"AutoBoxing"})
private RangeHighlighter createHighlighter(final Range range) {
+ assert ! myReleased;
int first =
range.getOffset1() >= myDocument.getLineCount() ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset1());
@@ -204,6 +208,7 @@ public class LineStatusTracker {
removeHighlightersFromMarkupModel();
myRanges.clear();
}
+ myReleased = true;
}
public Document getDocument() {
@@ -228,6 +233,7 @@ public class LineStatusTracker {
}
public void startBulkUpdate() {
+ if (myReleased) return;
synchronized (myLock) {
myBulkUpdate = true;
removeAnathema();
@@ -247,6 +253,7 @@ public class LineStatusTracker {
}
public void finishBulkUpdate() {
+ if (myReleased) return;
synchronized (myLock) {
myBulkUpdate = false;
reinstallRanges();
@@ -286,6 +293,7 @@ public class LineStatusTracker {
private final VcsDirtyScopeManager myVcsDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject);
public void beforeDocumentChange(DocumentEvent e) {
+ if (myReleased) return;
myApplication.assertWriteAccessAllowed();
synchronized (myLock) {
@@ -338,6 +346,11 @@ public class LineStatusTracker {
}
public void documentChanged(final DocumentEvent e) {
+ if (myReleased) {
+ return;
+ }
+ // TODO: remove assertion when cached document listeners will work ok
+ //assert ! myReleased;
myApplication.assertWriteAccessAllowed();
synchronized (myLock) {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java
index 37e2a0df0656..ccd8400d2534 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java
@@ -212,14 +212,9 @@ public class LineStatusTrackerManager implements ProjectComponent, LineStatusTra
if (tracker == null && (! shouldBeInstalled)) return;
if (tracker != null) {
- if (! shouldBeInstalled) {
- releaseTracker(document);
- return;
- } else {
- tracker.resetForBaseRevisionLoad();
- startAlarm(document, virtualFile);
- }
- } else if (shouldBeInstalled) {
+ releaseTracker(document);
+ }
+ if (shouldBeInstalled) {
installTracker(virtualFile, document);
}
}
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/expression/FlipSetterCallIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/expression/FlipSetterCallIntention.java
index 8dd58f6e008e..c83ff5dd1cfb 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/expression/FlipSetterCallIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/expression/FlipSetterCallIntention.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,9 @@ package com.siyeh.ipp.expression;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;
+import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
-import com.intellij.psi.util.PropertyUtil;
+import com.intellij.refactoring.psi.PropertyUtils;
import com.intellij.util.IncorrectOperationException;
import com.siyeh.ipp.base.Intention;
import com.siyeh.ipp.base.PsiElementEditorPredicate;
@@ -34,113 +35,106 @@ import java.util.List;
* @author Konstantin Bulenkov
*/
public class FlipSetterCallIntention extends Intention {
- private static final PsiElementPredicate PREDICATE = new SetterCallPredicate();
protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
- final Editor editor = getEditorByElementIfItHasSelection(element);
- if (editor == null) {
- if (element instanceof PsiMethodCallExpression) {
- flipCall((PsiMethodCallExpression)element);
+ final Project project = element.getProject();
+ final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
+ if (editor != null) {
+ final List methodCalls =
+ PsiSelectionSearcher.searchElementsInSelection(editor, project, PsiMethodCallExpression.class, false);
+ if (methodCalls.size() > 0) {
+ for (PsiMethodCallExpression call : methodCalls) {
+ flipCall(call);
+ }
+ editor.getSelectionModel().removeSelection();
+ return;
}
}
- else { // editor not null
- final List methodCalls =
- PsiSelectionSearcher.searchElementsInSelection(editor, element.getProject(), PsiMethodCallExpression.class, false);
- for (PsiMethodCallExpression call : methodCalls) {
- flipCall(call);
- }
- editor.getSelectionModel().removeSelection();
+ if (element instanceof PsiMethodCallExpression) {
+ flipCall((PsiMethodCallExpression)element);
}
}
@NotNull
protected PsiElementPredicate getElementPredicate() {
- return PREDICATE;
+ return new SetterCallPredicate();
}
private static void flipCall(PsiMethodCallExpression call) {
- PsiExpression qualifierExpression = call.getMethodExpression().getQualifierExpression();
- if (qualifierExpression == null) return;
- final String qualifier1 = qualifierExpression.getText();
- if (qualifier1 == null || qualifier1.length() == 0) return;
- final PsiMethodCallExpression param = (PsiMethodCallExpression)call.getArgumentList().getExpressions()[0];
- qualifierExpression = param.getMethodExpression().getQualifierExpression();
- if (qualifierExpression == null) return;
- final String qualifier2 = qualifierExpression.getText();
+ final PsiExpression qualifierExpression1 = call.getMethodExpression().getQualifierExpression();
+ if (qualifierExpression1 == null) {
+ return;
+ }
+ final PsiExpression[] arguments = call.getArgumentList().getExpressions();
+ if (arguments.length != 1) {
+ return;
+ }
+ final PsiExpression argument = arguments[0];
+ if (!(argument instanceof PsiMethodCallExpression)) {
+ return;
+ }
+ final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)argument;
+ final PsiExpression qualifierExpression2 = methodCallExpression.getMethodExpression().getQualifierExpression();
+ if (qualifierExpression2 == null) {
+ return;
+ }
final PsiMethod setter = call.resolveMethod();
- final PsiMethod getter = param.resolveMethod();
-
- if (getter == null || setter == null) return;
-
- final PsiMethod get = PropertyUtil.findPropertyGetter(setter.getContainingClass(), PropertyUtil.getPropertyName(setter), false, true);
- final PsiMethod set = PropertyUtil.findPropertySetter(getter.getContainingClass(), PropertyUtil.getPropertyName(getter), false, true);
-
- if (get == null || set == null) return;
-
- StringBuilder text = new StringBuilder();
- text.append(qualifier2).append(".").append(set.getName())
- .append("(")
- .append(qualifier1).append(".").append(get.getName()).append("()")
- .append(")");
- final PsiExpression newExpression =
- JavaPsiFacade.getElementFactory(call.getProject()).createExpressionFromText(text.toString(), call.getContext());
+ final PsiMethod getter = methodCallExpression.resolveMethod();
+ final PsiMethod get = PropertyUtils.getReversePropertyMethod(setter);
+ final PsiMethod set = PropertyUtils.getReversePropertyMethod(getter);
+ if (get == null || set == null) {
+ return;
+ }
+ final String text =
+ qualifierExpression2.getText() + "." + set.getName() + "(" + qualifierExpression1.getText() + "." + get.getName() + "())";
+ final PsiExpression newExpression = JavaPsiFacade.getElementFactory(call.getProject()).createExpressionFromText(text, call);
call.replace(newExpression);
}
- private static boolean isSetGetMethodCall(PsiMethodCallExpression call) {
- final PsiExpression[] params = call.getArgumentList().getExpressions();
- if (params.length != 1) return false;
- if (!(params[0] instanceof PsiMethodCallExpression)) return false;
- final PsiMethodCallExpression call2 = (PsiMethodCallExpression)params[0];
-
- //check expressions are simple properties
- final PsiElement methodElement = call.getMethodExpression().resolve();
- final PsiElement param = call2.getMethodExpression().resolve();
- if (!(methodElement instanceof PsiMethod)
- || !(param instanceof PsiMethod)
- || !PropertyUtil.isSimplePropertySetter((PsiMethod)methodElement)
- || !PropertyUtil.isSimplePropertyGetter((PsiMethod)param)) {
+ private static boolean isSetGetMethodCall(PsiElement element) {
+ if (!(element instanceof PsiMethodCallExpression)) {
+ return false;
+ }
+ final PsiMethodCallExpression call1 = (PsiMethodCallExpression)element;
+ final PsiExpression[] arguments = call1.getArgumentList().getExpressions();
+ if (arguments.length != 1) {
+ return false;
+ }
+ final PsiExpression argument = arguments[0];
+ if (!(argument instanceof PsiMethodCallExpression)) {
+ return false;
+ }
+ final PsiMethodCallExpression call2 = (PsiMethodCallExpression)argument;
+ final PsiMethod setter = call1.resolveMethod();
+ final PsiMethod getter = call2.resolveMethod();
+ final PsiMethod get = PropertyUtils.getReversePropertyMethod(setter);
+ final PsiMethod set = PropertyUtils.getReversePropertyMethod(getter);
+ if (setter == null || getter == null || get == null || set == null) {
return false;
}
- final PsiMethod setter1 = (PsiMethod)methodElement;
- final PsiMethod getter2 = (PsiMethod)param;
//check types compatibility
- if (!call.getArgumentList().getExpressionTypes()[0].equals(getter2.getReturnType())) return false;
-
- //check both classes have getters/setters
- final PsiMethod getter1 =
- PropertyUtil.findPropertyGetter(setter1.getContainingClass(), PropertyUtil.getPropertyName(setter1), false, true);
- if (getter1 == null) return false;
-
- final PsiMethod setter2 =
- PropertyUtil.findPropertyGetter(getter2.getContainingClass(), PropertyUtil.getPropertyName(getter2), false, true);
- if (setter2 == null) return false;
-
- return true;
- }
-
- @Nullable
- private static Editor getEditorByElementIfItHasSelection(@NotNull PsiElement element) {
- final Editor editor = FileEditorManager.getInstance(element.getProject()).getSelectedTextEditor();
- return editor != null && editor.getSelectionModel().hasSelection() ? editor : null;
+ final PsiParameter[] parameters = setter.getParameterList().getParameters();
+ if (parameters.length != 1) {
+ return false;
+ }
+ final PsiParameter parameter = parameters[0];
+ return parameter.getType().equals(getter.getReturnType());
}
private static class SetterCallPredicate extends PsiElementEditorPredicate {
@Override
public boolean satisfiedBy(PsiElement element, @Nullable Editor editor) {
- boolean underCorrectElement = element instanceof PsiMethodCallExpression && isSetGetMethodCall((PsiMethodCallExpression)element);
- if (editor == null || !editor.getSelectionModel().hasSelection()) {
- return underCorrectElement;
+ if (editor != null && editor.getSelectionModel().hasSelection()) {
+ final List list =
+ PsiSelectionSearcher.searchElementsInSelection(editor, element.getProject(), PsiMethodCallExpression.class, false);
+ for (PsiMethodCallExpression methodCallExpression : list) {
+ if (isSetGetMethodCall(methodCallExpression)) {
+ return true;
+ }
+ }
}
-
- final List list =
- PsiSelectionSearcher.searchElementsInSelection(editor, element.getProject(), PsiMethodCallExpression.class, false);
- for (PsiMethodCallExpression methodCallExpression : list) {
- if (isSetGetMethodCall(methodCallExpression)) return true;
- }
-
- return underCorrectElement;
+ return isSetGetMethodCall(element);
}
}
}
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/psiutils/PsiSelectionSearcher.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/psiutils/PsiSelectionSearcher.java
index f4e24f8a4613..e0579aa347cb 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/psiutils/PsiSelectionSearcher.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/psiutils/PsiSelectionSearcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package com.siyeh.ipp.psiutils;
import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
@@ -39,7 +40,7 @@ public class PsiSelectionSearcher {
* @param editor editor to get text selection
* @param project Project
* @param filter PsiElement filter, e.g. PsiMethodCallExpression.class
- * @param dontStopOnFound if true, visitor will look inside found elements. if false, visitor will stop looking for elements in children of found element
+ * @param searchChildrenOfFound if true, visitor will look for matching elements in the children of a found element, otherwise will not look inside found element.
* @param type based on PsiElement type
* @return elements in selection
*/
@@ -47,28 +48,31 @@ public class PsiSelectionSearcher {
public static List searchElementsInSelection(Editor editor,
Project project,
final Class filter,
- final boolean dontStopOnFound) {
- final TextRange selection = new TextRange(editor.getSelectionModel().getSelectionStart(), editor.getSelectionModel().getSelectionEnd());
-
+ final boolean searchChildrenOfFound) {
+ final SelectionModel selectionModel = editor.getSelectionModel();
+ if (!selectionModel.hasSelection()) {
+ return Collections.emptyList();
+ }
+ final TextRange selection = new TextRange(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd());
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
- if (file == null || file instanceof PsiCompiledElement) return Collections.emptyList();
-
+ if (file == null || file instanceof PsiCompiledElement) {
+ return Collections.emptyList();
+ }
final List results = new ArrayList();
final PsiElementVisitor visitor = new JavaRecursiveElementWalkingVisitor() {
@Override
public void visitElement(PsiElement element) {
- if (!selection.intersects(element.getTextRange())) return;
-
+ if (!selection.intersects(element.getTextRange())) {
+ return;
+ }
if (filter.isAssignableFrom(element.getClass())) {
results.add((T)element);
- if (dontStopOnFound) {
- super.visitElement(element);
+ if (!searchChildrenOfFound) {
+ return;
}
}
- else {
- super.visitElement(element);
- }
+ super.visitElement(element);
}
};
diff --git a/plugins/android/resources/messages/AndroidBundle.properties b/plugins/android/resources/messages/AndroidBundle.properties
index 61c9e09482f2..5e2930c3a5a2 100644
--- a/plugins/android/resources/messages/AndroidBundle.properties
+++ b/plugins/android/resources/messages/AndroidBundle.properties
@@ -149,9 +149,9 @@ android.manifest.not.found.error=AndroidManifest.xml doesn't exist or has incorr
android.apt.settings.title=AAPT Compiler
android.aidl.settings.title=AIDL Compiler
android.generate.r.java.checkbox=Re&generate R.java file when resources are changed
-android.dest.directory.title=De&stination directory
+android.dest.directory.title=De&stination directory\:
android.generate.r.java.by.res.dir=Use res&ource directory specified at "Structure" section
-android.use.custom.r.java.source.dir=Use custo&m resource directory
+android.use.custom.r.java.source.dir=Use custo&m resource directory\:
android.regenerate.idl.when.changed.checkbox=Regenerate &Java files when AIDL files are changed
android.wizard.application.project.button=&Application
android.wizard.lib.project.button=&Library
diff --git a/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java b/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java
index a5222ce3f74a..f71dbb397779 100644
--- a/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java
+++ b/plugins/android/src/org/jetbrains/android/compiler/AndroidCompileUtil.java
@@ -739,8 +739,12 @@ public class AndroidCompileUtil {
throws IOException {
if (file.isDirectory()) {
- for (File child : file.listFiles()) {
- addFileToJar(jar, child, rootDirectory, packRClasses);
+ final File[] children = file.listFiles();
+
+ if (children != null) {
+ for (File child : children) {
+ addFileToJar(jar, child, rootDirectory, packRClasses);
+ }
}
}
else if (file.isFile()) {
diff --git a/plugins/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java b/plugins/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java
index a12daa8df257..4e6e537b16df 100644
--- a/plugins/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java
+++ b/plugins/android/src/org/jetbrains/android/compiler/AndroidPrecompileTask.java
@@ -139,14 +139,18 @@ public class AndroidPrecompileTask implements CompileTask {
private static void removeAllPackages(@Nullable String sourceRootPath, @NotNull CompileContext context) {
final File sourceRoot = new File(sourceRootPath);
- for (File child : sourceRoot.listFiles()) {
- if (child.isDirectory() &&
- child.getName() != null &&
- StringUtil.isJavaIdentifier(child.getName())) {
+ final File[] children = sourceRoot.listFiles();
- if (!FileUtil.delete(child)) {
- context.addMessage(CompilerMessageCategory.ERROR, "Cannot delete file " + child.getAbsolutePath(),
- null, -1, -1);
+ if (children != null) {
+ for (File child : children) {
+ if (child.isDirectory() &&
+ child.getName() != null &&
+ StringUtil.isJavaIdentifier(child.getName())) {
+
+ if (!FileUtil.delete(child)) {
+ context.addMessage(CompilerMessageCategory.ERROR, "Cannot delete file " + child.getAbsolutePath(),
+ null, -1, -1);
+ }
}
}
}
diff --git a/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java b/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java
index 7fd1c36e7179..93a1905e390c 100644
--- a/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java
+++ b/plugins/android/src/org/jetbrains/android/compiler/tools/AndroidDxRunner.java
@@ -157,8 +157,12 @@ public class AndroidDxRunner {
}
if (file.isDirectory()) {
- for (File child : file.listFiles()) {
- collectFiles(root, child, result, visited, qNames);
+ final File[] children = file.listFiles();
+
+ if (children != null) {
+ for (File child : children) {
+ collectFiles(root, child, result, visited, qNames);
+ }
}
}
else {
diff --git a/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java b/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
index b515b1cf7964..836dfb362a4f 100644
--- a/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
+++ b/plugins/android/src/org/jetbrains/android/newProject/AndroidModuleBuilder.java
@@ -253,15 +253,18 @@ public class AndroidModuleBuilder extends JavaModuleBuilder {
AndroidUtils.runExternalTool(project, commandLine, true, null);
if (finalTempContentRoot != null) {
- for (File child : finalTempContentRoot.listFiles()) {
+ final File[] children = finalTempContentRoot.listFiles();
- if (SdkConstants.FD_SOURCES.equals(child.getName())) {
- continue;
- }
- final File to = new File(contentRoot.getPath(), child.getName());
+ if (children != null) {
+ for (File child : children) {
+ if (SdkConstants.FD_SOURCES.equals(child.getName())) {
+ continue;
+ }
+ final File to = new File(contentRoot.getPath(), child.getName());
- if (!FileUtil.moveDirWithContent(child, to)) {
- LOG.error("Cannot move content from " + child.getPath() + " to " + to.getPath());
+ if (!FileUtil.moveDirWithContent(child, to)) {
+ LOG.error("Cannot move content from " + child.getPath() + " to " + to.getPath());
+ }
}
}
diff --git a/plugins/android/src/org/jetbrains/android/resourceManagers/LocalResourceManager.java b/plugins/android/src/org/jetbrains/android/resourceManagers/LocalResourceManager.java
index d37f4e5b992c..d0ae0d69c90d 100644
--- a/plugins/android/src/org/jetbrains/android/resourceManagers/LocalResourceManager.java
+++ b/plugins/android/src/org/jetbrains/android/resourceManagers/LocalResourceManager.java
@@ -72,7 +72,7 @@ public class LocalResourceManager extends ResourceManager {
@Override
public VirtualFile[] getAllResourceDirs() {
Set result = new HashSet();
- collectResourceDirs(getModule(), result);
+ collectResourceDirs(getModule(), result, new HashSet());
return VfsUtil.toVirtualFileArray(result);
}
@@ -101,13 +101,17 @@ public class LocalResourceManager extends ResourceManager {
return AndroidRootUtil.getResourceOverlayDirs(getModule());
}
- private static void collectResourceDirs(Module module, Set result) {
+ private static void collectResourceDirs(Module module, Set result, Set visited) {
+ if (!visited.add(module)) {
+ return;
+ }
+
VirtualFile resDir = AndroidRootUtil.getResourceDir(module);
if (resDir != null && !result.add(resDir)) {
return;
}
for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(module, false)) {
- collectResourceDirs(depFacet.getModule(), result);
+ collectResourceDirs(depFacet.getModule(), result, visited);
}
}
diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateOptionsPanel.form b/plugins/git4idea/src/git4idea/update/GitUpdateOptionsPanel.form
index ec4d512199fb..db27637ca0c1 100644
--- a/plugins/git4idea/src/git4idea/update/GitUpdateOptionsPanel.form
+++ b/plugins/git4idea/src/git4idea/update/GitUpdateOptionsPanel.form
@@ -15,7 +15,7 @@
-
+
@@ -56,7 +56,7 @@
-
+
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java
index 43c3f8f4cd30..fa234ee2a2bf 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradlePositionManager.java
@@ -30,8 +30,8 @@ import com.intellij.psi.PsiManager;
import com.intellij.psi.util.CachedValue;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.util.containers.FactoryMap;
import com.intellij.util.containers.ConcurrentFactoryMap;
+import com.intellij.util.containers.FactoryMap;
import com.intellij.util.lang.UrlClassLoader;
import com.sun.jdi.AbsentInformationException;
import com.sun.jdi.ReferenceType;
@@ -69,7 +69,7 @@ public class GradlePositionManager extends ScriptPositionManagerHelper {
}
public boolean isAppropriateScriptFile(@NotNull final PsiFile scriptFile) {
- return GroovyScriptTypeDetector.isSpecificScriptFile((GroovyFile)scriptFile, GradleScriptType.INSTANCE);
+ return scriptFile instanceof GroovyFile && GroovyScriptTypeDetector.isSpecificScriptFile((GroovyFile)scriptFile, GradleScriptType.INSTANCE);
}
@NotNull
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyBundle.properties b/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyBundle.properties
index 8b7b70e6c566..8b6b797ae88d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyBundle.properties
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyBundle.properties
@@ -260,7 +260,7 @@ class.is.not.expected.here=Class is not expected here
fix.package.name=Fix package name
#dynamic properties
-add.dynamic.property=Add dynamic property ''{0}''
+add.dynamic.property=Add Dynamic Property ''{0}''
duplicate.element.in.the.map=Duplicate element in the map
dynamic.toolwindow.search.elements=Search dynamic element
dynamic.toolwindow.property.filter=Property Filter
@@ -271,16 +271,16 @@ create.field.from.usage=Create Field ''{0}''
create.method.from.usage=Create Method ''{0}''
create.variable.from.usage=Create Variable ''{0}''
add.dynamic.element=Add dynamic element
-add.dynamic.method=Add dynamic method
+add.dynamic.method=Add Dynamic Method
dynamic.type=Type
dynamic.name=Name
dynamic.properties.table.name=Method arguments
dynamic.method.return.type=Return type
dynamic.method.property.type=Property type
are.you.sure.to.delete.dynamic.property=Are you sure to delete ''{0}''?
-dynamic.property.deletion=Deletion dynamic property
+dynamic.property.deletion=Deletion Dynamic Property
are.you.sure.to.delete.elements=Are you sure to delete ''{0}'' elements?
-dynamic.element.deletion=Dynamic element deletion
+dynamic.element.deletion=Dynamic Element Deletion
dynamic.window=Dynamic window
dynamic.properties.table.no.arguments=Arguments list is empty.
assignment.expected='=' expected
@@ -304,7 +304,7 @@ break.outside.loop=The break statement with named labels is only allowed inside
Constructor=Constructor
Getter=Getter
Setter=Setter
-groovy.like.library.found=Groovy library found
+groovy.like.library.found=Groovy Library Found
groovy.like.library.found.text=Do you want to set up Groovy for module ''{0}'' \n\
with found library ''{1}'' (Groovy version {2})?
compile.groovy.files=&Compile Groovy files
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyCodeInsightBundle.properties b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyCodeInsightBundle.properties
index 9b5b7606bac5..f42faeabcaac 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyCodeInsightBundle.properties
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/generate/GroovyCodeInsightBundle.properties
@@ -1,5 +1,5 @@
generate.equals.and.hashcode.already.defined.warning.anonymous=equals() and hashCode() already defined
generate.equals.and.hashcode.already.defined.warning=equals() and hashCode() already defined
-generate.equals.and.hashcode.already.defined.title=equals() and hashCode() already defined
+generate.equals.and.hashcode.already.defined.title=equals() and hashCode() Already Defined
generate.equals.compare.nested.arrays.comment= // Compare nested arrays - values of {0} here
generate.equals.compare.arrays.comment= // Probably incorrect - comparing Object[] arrays with Arrays.equals
\ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
index c67aec8f8dc0..26f7775ca063 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
@@ -787,7 +787,7 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
assert file != null;
PsiDirectory psiDirectory = file.getContainingDirectory();
- if (psiDirectory != null) {
+ if (psiDirectory != null && file instanceof GroovyFile) {
PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(psiDirectory);
if (aPackage != null) {
String packageName = aPackage.getQualifiedName();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrMoveToDirFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrMoveToDirFix.java
index 3ed96eb198b7..73c5f52c3bf6 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrMoveToDirFix.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/GrMoveToDirFix.java
@@ -79,6 +79,8 @@ public class GrMoveToDirFix implements IntentionAction {
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+ if (!(file instanceof GroovyFile)) return;
+
final String packageName = ((GroovyFile)file).getPackageName();
final Module module = ModuleUtil.findModuleForFile(file.getVirtualFile(), project);
PsiDirectory directory = PackageUtil.findOrCreateDirectoryForPackage(module, packageName, null, true);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicToolWindowWrapper.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicToolWindowWrapper.java
index 46d8dd4b7372..512e00e1dc75 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicToolWindowWrapper.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/DynamicToolWindowWrapper.java
@@ -40,14 +40,15 @@ import com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns;
import com.intellij.ui.treeStructure.treetable.TreeTable;
import com.intellij.ui.treeStructure.treetable.TreeTableModel;
import com.intellij.ui.treeStructure.treetable.TreeTableTree;
-import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.AbstractTableCellEditor;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyBundle;
import org.jetbrains.plugins.groovy.GroovyFileType;
@@ -66,6 +67,7 @@ import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collection;
@@ -247,7 +249,7 @@ public class DynamicToolWindowWrapper {
myTreeTable.setTreeCellRenderer(treeCellRenderer);
myTreeTable.setRootVisible(false);
- myTreeTable.setSelectionMode(DefaultTreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
+ myTreeTable.setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
final MyPropertyTypeCellEditor typeCellEditor = new MyPropertyTypeCellEditor();
@@ -318,11 +320,11 @@ public class DynamicToolWindowWrapper {
final String qualifiedName = ((PsiClass)element).getQualifiedName();
return new RefactoringElementListener() {
- public void elementMoved(PsiElement newElement) {
+ public void elementMoved(@NotNull PsiElement newElement) {
renameElement(qualifiedName, newElement);
}
- public void elementRenamed(PsiElement newElement) {
+ public void elementRenamed(@NotNull PsiElement newElement) {
renameElement(qualifiedName, newElement);
}
@@ -358,7 +360,7 @@ public class DynamicToolWindowWrapper {
final int selectionRow = myTreeTable.getTree().getLeadSelectionRow();
myTreeTable.editCellAt(selectionRow, TYPE_COLUMN, event);
}
- }, KeyStroke.getKeyStroke(KeyEvent.VK_F2, KeyEvent.CTRL_MASK), JComponent.WHEN_FOCUSED);
+ }, KeyStroke.getKeyStroke(KeyEvent.VK_F2, InputEvent.CTRL_MASK), JComponent.WHEN_FOCUSED);
// todo use "myTreeTable.setAutoCreateRowSorter(true);" since 1.6
@@ -510,7 +512,7 @@ public class DynamicToolWindowWrapper {
}
}
- class ClassColumnInfo extends ColumnInfo {
+ static class ClassColumnInfo extends ColumnInfo {
public ClassColumnInfo(String name) {
super(name);
}
@@ -565,7 +567,7 @@ public class DynamicToolWindowWrapper {
if (!(childObject instanceof DItemElement)) break;
filterText = getFilter();
- if (filterText == null || "".equals(filterText)) {
+ if (filterText == null || filterText.isEmpty()) {
((DItemElement)childObject).setHightlightedText("");
dynamicNodes.add(dynamicNode);
@@ -689,7 +691,8 @@ public class DynamicToolWindowWrapper {
}
private static String[] mapToUnqualified(final String[] argumentsNames) {
- return ContainerUtil.map2Array(argumentsNames, String.class, new Function() {
+ return ContainerUtil.map2Array(argumentsNames, String.class, new NullableFunction() {
+ @Nullable
public String fun(final String s) {
if (s == null) return null;
int index = s.lastIndexOf(".");
@@ -741,7 +744,7 @@ public class DynamicToolWindowWrapper {
if (element == null) return null;
return element.getContainingFile();
- } else if (LangDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
+ } else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
return new DeleteProvider() {
@Override
public void deleteElement(DataContext dataContext) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/ui/DynamicDialog.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/ui/DynamicDialog.java
index 42b165d1c77d..2d6746084924 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/ui/DynamicDialog.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/dynamic/ui/DynamicDialog.java
@@ -148,7 +148,7 @@ public abstract class DynamicDialog extends DialogWrapper {
setStatusTextAndIcon(null, "");
}
- private void setStatusTextAndIcon(final Icon icon, final String text) {
+ private void setStatusTextAndIcon(@Nullable final Icon icon, final String text) {
myTypeStatusLabel.setIcon(icon);
myTypeStatusLabel.setText(text);
pack();
@@ -177,7 +177,7 @@ public abstract class DynamicDialog extends DialogWrapper {
public void actionPerformed(ActionEvent e) {
myClassComboBox.requestFocus();
}
- }, KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
+ }, KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
@Nullable
@@ -191,7 +191,7 @@ public abstract class DynamicDialog extends DialogWrapper {
final EditorComboBoxEditor comboEditor = new EditorComboBoxEditor(myProject, GroovyFileType.GROOVY_FILE_TYPE);
final Document document = createDocument("");
- assert document != null;
+ LOG.assertTrue(document != null);
comboEditor.setItem(document);
@@ -213,7 +213,7 @@ public abstract class DynamicDialog extends DialogWrapper {
public void actionPerformed(ActionEvent e) {
myTypeComboBox.requestFocus();
}
- }, KeyStroke.getKeyStroke(KeyEvent.VK_T, KeyEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
+ }, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
final EditorTextField editorTextField = (EditorTextField) myTypeComboBox.getEditor().getEditorComponent();
@@ -228,9 +228,6 @@ public abstract class DynamicDialog extends DialogWrapper {
});
PsiType type = typeConstraints.length == 1 ? typeConstraints[0].getDefaultType() : TypesUtil.getJavaLangObject(myContext);
- if (type == null) {
- type = TypesUtil.getJavaLangObject(myContext);
- }
myTypeComboBox.getEditor().setItem(createDocument(type.getCanonicalText()));
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
index 7a030222512d..a7d6f5302f2c 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/BaseInspection.java
@@ -95,9 +95,6 @@ public abstract class BaseInspection extends GroovySuppressableInspectionTool {
final BaseInspectionVisitor visitor = buildGroovyVisitor(problemsHolder, isOnTheFly);
groovyFile.accept(visitor);
final List problems = problemsHolder.getResults();
- if (problems == null) {
- return null;
- }
return problems.toArray(new ProblemDescriptor[problems.size()]);
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties
index cc1890234c9f..e89d06c35cff 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties
@@ -46,7 +46,7 @@ dynamic.property=Dynamic property
unresolved.type.status=Type ''{0}'' is not resolved
resolved.type.status=Type ''{0}'' is resolved
no.type.specified=No type specified
-dynamic.element=Dynamic element
+dynamic.element=Dynamic Element
########################################################################################################################
# InpectorGroovy properties
@@ -57,7 +57,7 @@ pointless.boolean.display.name=Pointless boolean expression
pointless.boolean.quickfix=Simplify
Cannot.perform.undo.operation=Cannot perform undo operation
-Undo.disable=Undo disabled
+Undo.disable=Undo Disabled
field.already.defined=Variables with field names
access.to.inaccessible.element=Access to inaccessible element
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyAccessibilityInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyAccessibilityInspection.java
index a1d885d4a0dc..ee573ff774aa 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyAccessibilityInspection.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GroovyAccessibilityInspection.java
@@ -108,7 +108,9 @@ public class GroovyAccessibilityInspection extends BaseInspection {
String[] modifiers = {PsiModifier.PROTECTED, PsiModifier.PUBLIC, PsiModifier.PACKAGE_LOCAL};
PsiClass accessObjectClass = PsiTreeUtil.getParentOfType(location, PsiClass.class, false);
if (accessObjectClass == null) {
- accessObjectClass = ((GroovyFile)location.getContainingFile()).getScriptClass();
+ final PsiFile file = location.getContainingFile();
+ if (!(file instanceof GroovyFile)) return GroovyFix.EMPTY_ARRAY;
+ accessObjectClass = ((GroovyFile)file).getScriptClass();
}
for (int i = ArrayUtil.indexOf(modifiers, minModifier); i < modifiers.length; i++) {
String modifier = modifiers[i];
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompiler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompiler.java
index 4dc37f8f06f6..4f20b2256506 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompiler.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompiler.java
@@ -138,7 +138,8 @@ public class GroovyCompiler extends GroovyCompilerBase {
"You seem to have global Groovy AST transformations defined in your project,\n" +
"but they won't be applied to your code because they are not marked as compiler resources.\n" +
"Do you want to add them to compiler resource list?\n" +
- "(you can do it yourself later in Settings | Compiler | Resource patterns)", "AST Transformations found",
+ "(you can do it yourself later in Settings | Compiler | Resource patterns)",
+ "AST Transformations Found",
GroovyIcons.GROOVY_ICON_32x32);
if (result == 0) {
CompilerConfiguration.getInstance(myProject).addResourceFilePattern(AST_TRANSFORM_FILE_NAME);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java
index d19dce534bf8..609d1db536bc 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/grape/GrabDependencies.java
@@ -103,7 +103,8 @@ public class GrabDependencies implements IntentionAction {
assert vfile != null;
if (JavaPsiFacade.getInstance(project).findClass("org.apache.ivy.core.report.ResolveReport", file.getResolveScope()) == null) {
- Messages.showErrorDialog("Sorry, but IDEA cannot @Grab the dependencies without Ivy. Please add Ivy to your module dependencies and re-run the action.", "Ivy missing");
+ Messages.showErrorDialog("Sorry, but IDEA cannot @Grab the dependencies without Ivy. Please add Ivy to your module dependencies and re-run the action.",
+ "Ivy Missing");
return;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties
index 17988f9cecce..23bda96924da 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/GroovyIntentionsBundle.properties
@@ -90,7 +90,7 @@ do.not.create.first.new=Use &existing first parameter as map for named arguments
convert.cannot.itself=Refactoring is not available for map parameter itself
perform.refactoring=Performing refactoring
map.param.name=Map parameter &name:
-convert.param.to.map.entry=Convert parameter to map entry
+convert.param.to.map.entry=Convert Parameter to Map Entry
convert.java.style.array.intention.name=Convert java-style array creation
convert.java.style.array.intention.family.name=Convert Java-Style Array Creation to Groovy Syntax
@@ -102,7 +102,7 @@ create.parameter.for.field=Add parameter for field ''{0}''
create.parameter.for.fields=Add parameter for field...
closure.used.as.variable=Closure is passed as argument. Refactoring can break semantic.
-convert.map.to.class.intention.name=Convert to class
+convert.map.to.class.intention.name=Convert to Class
convert.map.to.class.intention.family.name=Convert Groovy native map to class instances
do.you.want.to.change.method.return.type=Do you want to change return type of ''{0}'' method
do.you.want.to.change.variable.type=Do you want to change type of ''{0}''
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java
index cc3a9e6595cf..f9c42d5f16fa 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java
@@ -40,7 +40,6 @@ import org.jetbrains.plugins.groovy.intentions.base.Intention;
import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate;
import org.jetbrains.plugins.groovy.lang.GrReferenceAdjuster;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
@@ -77,7 +76,8 @@ public class ConvertMapToClassIntention extends Intention {
final GrListOrMap map = (GrListOrMap)element;
final GrNamedArgument[] namedArguments = map.getNamedArguments();
LOG.assertTrue(map.getInitializers().length == 0);
- final String packageName = ((GroovyFileBase)map.getContainingFile()).getPackageName();
+ final PsiFile file = map.getContainingFile();
+ final String packageName = file instanceof GroovyFileBase ? ((GroovyFileBase)file).getPackageName() : "";
final CreateClassDialog dialog =
new CreateClassDialog(project, GroovyBundle.message("create.class.family.name"), "", packageName, CreateClassKind.CLASS, true,
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/RemoveParenthesesFromMethodPredicate.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/RemoveParenthesesFromMethodPredicate.java
index e91359015fb3..7777942d78a6 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/RemoveParenthesesFromMethodPredicate.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/RemoveParenthesesFromMethodPredicate.java
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.groovy.intentions.conversions;
import com.intellij.psi.PsiElement;
+import com.intellij.util.IncorrectOperationException;
import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
@@ -50,8 +51,13 @@ class RemoveParenthesesFromMethodPredicate implements PsiElementPredicate {
if (rightParen != null) rightParen.delete();
newStatementText.append(argumentList.getText());
}
- final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(element.getProject());
- final GrStatement newStatement = factory.createStatementFromText(newStatementText.toString());
+ final GrStatement newStatement;
+ try {
+ newStatement = GroovyPsiElementFactory.getInstance(element.getProject()).createStatementFromText(newStatementText.toString());
+ }
+ catch (IncorrectOperationException e) {
+ return false;
+ }
if (newStatement instanceof GrApplicationStatement) {
final GrCommandArgumentList newArgList = ((GrApplicationStatement)newStatement).getArgumentList();
if (newArgList == null && argumentList == null ||
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportOnDemandIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportOnDemandIntention.java
index 8683a9ab471b..320b1b6d0918 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportOnDemandIntention.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportOnDemandIntention.java
@@ -29,7 +29,10 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.intentions.base.Intention;
import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate;
import org.jetbrains.plugins.groovy.lang.GrReferenceAdjuster;
-import org.jetbrains.plugins.groovy.lang.psi.*;
+import org.jetbrains.plugins.groovy.lang.psi.GrQualifiedReference;
+import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
/**
@@ -41,10 +44,10 @@ public class ImportOnDemandIntention extends Intention {
@Override
protected void processIntention(@NotNull PsiElement element, Project project, Editor editor) throws IncorrectOperationException {
- LOG.assertTrue(element instanceof GrReferenceElement);
+ if (!(element instanceof GrReferenceElement)) return;
final GrReferenceElement ref = (GrReferenceElement)element;
final PsiElement resolved = ref.resolve();
- LOG.assertTrue(resolved instanceof PsiClass);
+ if (!(resolved instanceof PsiClass)) return;
final String qname = ((PsiClass)resolved).getQualifiedName();
@@ -52,7 +55,7 @@ public class ImportOnDemandIntention extends Intention {
GroovyPsiElementFactory.getInstance(project).createImportStatementFromText(qname, true, true, null);
final PsiFile containingFile = element.getContainingFile();
- LOG.assertTrue(containingFile instanceof GroovyFile);
+ if (!(containingFile instanceof GroovyFile)) return;
((GroovyFile)containingFile).addImport(importStatement);
for (PsiReference reference : ReferencesSearch.search(resolved, new LocalSearchScope(containingFile), true)) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportStaticIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportStaticIntention.java
index bc9ef5f0c7bd..36ceb3948420 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportStaticIntention.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/ImportStaticIntention.java
@@ -43,19 +43,20 @@ public class ImportStaticIntention extends Intention {
@Override
protected void processIntention(@NotNull PsiElement element, Project project, Editor editor) throws IncorrectOperationException {
- LOG.assertTrue(element instanceof GrReferenceExpression);
+ if (!(element instanceof GrReferenceExpression)) return;
final GrReferenceExpression ref = (GrReferenceExpression)element;
final PsiElement resolved = ref.resolve();
- LOG.assertTrue(resolved instanceof PsiMember);
+ if (!(resolved instanceof PsiMember)) return;
final PsiClass containingClass = ((PsiMember)resolved).getContainingClass();
- LOG.assertTrue(containingClass != null);
+ if (containingClass == null) return;
final String qname = containingClass.getQualifiedName();
final String name = ((PsiMember)resolved).getName();
final PsiFile containingFile = element.getContainingFile();
- LOG.assertTrue(containingFile instanceof GroovyFile);
- ((GroovyFile)containingFile).accept(new GroovyRecursiveElementVisitor() {
+ if (!(containingFile instanceof GroovyFile)) return;
+ final GroovyFile file = (GroovyFile)containingFile;
+ file.accept(new GroovyRecursiveElementVisitor() {
@Override
public void visitReferenceExpression(GrReferenceExpression expression) {
super.visitReferenceExpression(expression);
@@ -72,7 +73,7 @@ public class ImportStaticIntention extends Intention {
GroovyPsiElementFactory.getInstance(project).createImportStatementFromText(qname + "." + name, true, false, null);
- ((GroovyFile)containingFile).addImport(importStatement);
+ file.addImport(importStatement);
for (PsiReference reference : ReferencesSearch.search(resolved, new LocalSearchScope(containingFile))) {
final PsiElement refElement = reference.getElement();
@@ -82,7 +83,7 @@ public class ImportStaticIntention extends Intention {
}
- ((GroovyFile)containingFile).accept(new GroovyRecursiveElementVisitor() {
+ file.accept(new GroovyRecursiveElementVisitor() {
@Override
public void visitReferenceExpression(GrReferenceExpression expression) {
super.visitReferenceExpression(expression);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/GroovyMapParameterDialog.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/GroovyMapParameterDialog.java
index cbec4da4b9e5..996026fa150a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/GroovyMapParameterDialog.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/parameterToEntry/GroovyMapParameterDialog.java
@@ -161,7 +161,7 @@ public class GroovyMapParameterDialog extends DialogWrapper {
public void actionPerformed(ActionEvent e) {
myNameComboBox.requestFocus();
}
- }, KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
+ }, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.ALT_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
for (String possibleName : possibleNames) {
myNameComboBox.addItem(possibleName);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/GrReferenceAdjuster.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/GrReferenceAdjuster.java
index df87b6bbfc29..67efad10bc79 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/GrReferenceAdjuster.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/GrReferenceAdjuster.java
@@ -91,36 +91,38 @@ public class GrReferenceAdjuster {
final PsiElement resolved = resolveRef(ref, uncomplete);
if (resolved == null) return false;
- if (!CodeStyleSettingsManager.getSettings(ref.getProject()).INSERT_INNER_CLASS_IMPORTS && resolved instanceof PsiClass && ((PsiClass)resolved).getContainingClass() != null) {
- return false;
- }
-
- final GrQualifiedReference copy = getCopy(ref);
-
- copy.setQualifier(null);
- if (!copy.isReferenceTo(resolved)) {
- if (resolved instanceof PsiClass) {
- final GroovyFileBase file = (GroovyFileBase)ref.getContainingFile();
- final PsiClass clazz = (PsiClass)resolved;
- final String qName = clazz.getQualifiedName();
- if (qName != null) {
- if (addImports && mayInsertImport(ref)) {
- final GrImportStatement added = file.addImportForClass(clazz);
- if (!copy.isReferenceTo(resolved)) {
- file.removeImport(added);
- return false;
- }
- }
- }
- }
- else {
- return false;
- }
- }
+ if (!checkCopyWithoutQualifier(ref, addImports, resolved)) return false;
ref.setQualifier(null);
return true;
}
+ private static boolean checkCopyWithoutQualifier(GrQualifiedReference ref,
+ boolean addImports,
+ PsiElement resolved) {
+ final GrQualifiedReference copy = getCopy(ref);
+ copy.setQualifier(null);
+
+ if (copy.isReferenceTo(resolved)) return true;
+
+ if (resolved instanceof PsiClass) {
+ final PsiClass clazz = (PsiClass)resolved;
+ final String qName = clazz.getQualifiedName();
+ if (qName != null && addImports && checkIsInnerClass(clazz) && mayInsertImport(ref)) {
+ final GroovyFileBase file = (GroovyFileBase)ref.getContainingFile();
+ final GrImportStatement added = file.addImportForClass(clazz);
+ if (copy.isReferenceTo(resolved)) return true;
+ file.removeImport(added);
+ }
+ }
+
+ return false;
+ }
+
+ private static boolean checkIsInnerClass(PsiClass resolved) {
+ final PsiClass containingClass = resolved.getContainingClass();
+ return containingClass == null || CodeStyleSettingsManager.getSettings(resolved.getProject()).INSERT_INNER_CLASS_IMPORTS;
+ }
+
@Nullable
private static PsiElement resolveRef(GrQualifiedReference ref, boolean uncomplete) {
if (!uncomplete) return ref.resolve();
@@ -176,7 +178,8 @@ public class GrReferenceAdjuster {
private static boolean mayInsertImport(GrQualifiedReference ref) {
return PsiTreeUtil.getParentOfType(ref, GrDocComment.class) == null &&
!(ref.getContainingFile() instanceof GroovyCodeFragment) &&
- PsiTreeUtil.getParentOfType(ref, GrImportStatement.class) == null;
+ PsiTreeUtil.getParentOfType(ref, GrImportStatement.class) == null &&
+ ref.getContainingFile() instanceof GroovyFileBase;
}
public static boolean seemsToBeQualifiedClassName(@Nullable GrExpression expr) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java
index c92b9f1b3794..e73b13cb07a8 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyClassNameInsertHandler.java
@@ -55,7 +55,8 @@ public class GroovyClassNameInsertHandler implements InsertHandler CLASS_DEFINITION =
new GrTypeDefinitionElementType("class definition") {
- public GrClassDefinition createPsi(GrTypeDefinitionStub stub) {
+ public GrClassDefinition createPsi(@NotNull GrTypeDefinitionStub stub) {
return new GrClassDefinitionImpl(stub);
}
};
GrStubElementType INTERFACE_DEFINITION =
new GrTypeDefinitionElementType("interface definition") {
- public GrInterfaceDefinition createPsi(GrTypeDefinitionStub stub) {
+ public GrInterfaceDefinition createPsi(@NotNull GrTypeDefinitionStub stub) {
return new GrInterfaceDefinitionImpl(stub);
}
};
GrStubElementType ENUM_DEFINITION =
new GrTypeDefinitionElementType("enumeration definition") {
- public GrEnumTypeDefinition createPsi(GrTypeDefinitionStub stub) {
+ public GrEnumTypeDefinition createPsi(@NotNull GrTypeDefinitionStub stub) {
return new GrEnumTypeDefinitionImpl(stub);
}
};
GrStubElementType ANNOTATION_DEFINITION =
new GrTypeDefinitionElementType("annotation definition") {
- public GrAnnotationTypeDefinition createPsi(GrTypeDefinitionStub stub) {
+ public GrAnnotationTypeDefinition createPsi(@NotNull GrTypeDefinitionStub stub) {
return new GrAnnotationTypeDefinitionImpl(stub);
}
};
GrStubElementType ANONYMOUS_CLASS_DEFINITION =
new GrTypeDefinitionElementType("Anonymous class") {
@Override
- public GrAnonymousClassDefinition createPsi(GrTypeDefinitionStub stub) {
+ public GrAnonymousClassDefinition createPsi(@NotNull GrTypeDefinitionStub stub) {
return new GrAnonymousClassDefinitionImpl(stub);
}
};
@@ -101,7 +101,7 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
GrStubElementType ENUM_CONSTANT_INITIALIZER =
new GrTypeDefinitionElementType("Enum constant initializer") {
@Override
- public GrEnumConstantInitializer createPsi(GrTypeDefinitionStub stub) {
+ public GrEnumConstantInitializer createPsi(@NotNull GrTypeDefinitionStub stub) {
return new GrEnumConstantInitializerImpl(stub);
}
};
@@ -112,13 +112,13 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
GrStubElementType FIELD = new GrFieldElementType();
GrMethodElementType METHOD_DEFINITION = new GrMethodElementType("method definition") {
- public GrMethod createPsi(GrMethodStub stub) {
+ public GrMethod createPsi(@NotNull GrMethodStub stub) {
return new GrMethodImpl(stub);
}
};
GrStubElementType ANNOTATION_METHOD = new GrMethodElementType("annotation method") {
@Override
- public GrMethod createPsi(GrMethodStub stub) {
+ public GrMethod createPsi(@NotNull GrMethodStub stub) {
return new GrAnnotationMethodImpl(stub);
}
@@ -133,12 +133,12 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
};
GrReferenceListElementType IMPLEMENTS_CLAUSE = new GrReferenceListElementType("implements clause") {
- public GrImplementsClause createPsi(GrReferenceListStub stub) {
+ public GrImplementsClause createPsi(@NotNull GrReferenceListStub stub) {
return new GrImplementsClauseImpl(stub);
}
};
GrReferenceListElementType EXTENDS_CLAUSE = new GrReferenceListElementType("super class clause") {
- public GrExtendsClause createPsi(GrReferenceListStub stub) {
+ public GrExtendsClause createPsi(@NotNull GrReferenceListStub stub) {
return new GrExtendsClauseImpl(stub);
}
};
@@ -263,19 +263,19 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
GroovyElementType TYPE_ARGUMENT = new GroovyElementType("type argument");
EmptyStubElementType TYPE_PARAMETER_LIST = new EmptyStubElementType("type parameter list", GroovyFileType.GROOVY_LANGUAGE) {
@Override
- public GrTypeParameterList createPsi(EmptyStub stub) {
+ public GrTypeParameterList createPsi(@NotNull EmptyStub stub) {
return new GrTypeParameterListImpl(stub);
}
};
GrStubElementType TYPE_PARAMETER = new GrStubElementType("type parameter") {
@Override
- public GrTypeParameter createPsi(GrTypeParameterStub stub) {
+ public GrTypeParameter createPsi(@NotNull GrTypeParameterStub stub) {
return new GrTypeParameterImpl(stub);
}
@Override
- public GrTypeParameterStub createStub(GrTypeParameter psi, StubElement parentStub) {
+ public GrTypeParameterStub createStub(@NotNull GrTypeParameter psi, StubElement parentStub) {
return new GrTypeParameterStub(parentStub, StringRef.fromString(psi.getName()));
}
@@ -295,7 +295,7 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
GrMethodElementType CONSTRUCTOR_DEFINITION = new GrMethodElementType("constructor definition") {
@Override
- public GrMethod createPsi(GrMethodStub stub) {
+ public GrMethod createPsi(@NotNull GrMethodStub stub) {
return new GrConstructorImpl(stub);
}
};
@@ -313,12 +313,12 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
GrStubElementType ANNOTATION = new GrStubElementType("annotation") {
@Override
- public GrAnnotation createPsi(GrAnnotationStub stub) {
+ public GrAnnotation createPsi(@NotNull GrAnnotationStub stub) {
return new GrAnnotationImpl(stub);
}
@Override
- public GrAnnotationStub createStub(GrAnnotation psi, StubElement parentStub) {
+ public GrAnnotationStub createStub(@NotNull GrAnnotation psi, StubElement parentStub) {
return new GrAnnotationStub(parentStub, psi);
}
@@ -335,19 +335,19 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
//parameters
EmptyStubElementType PARAMETERS_LIST = new EmptyStubElementType("parameters list", GroovyFileType.GROOVY_LANGUAGE) {
@Override
- public GrParameterList createPsi(EmptyStub stub) {
+ public GrParameterList createPsi(@NotNull EmptyStub stub) {
return new GrParameterListImpl(stub);
}
};
GrStubElementType PARAMETER = new GrStubElementType("parameter") {
@Override
- public GrParameter createPsi(GrParameterStub stub) {
+ public GrParameter createPsi(@NotNull GrParameterStub stub) {
return new GrParameterImpl(stub);
}
@Override
- public GrParameterStub createStub(GrParameter psi, StubElement parentStub) {
+ public GrParameterStub createStub(@NotNull GrParameter psi, StubElement parentStub) {
return new GrParameterStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi), GrStubUtils.getTypeText(psi));
}
@@ -369,7 +369,7 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
EmptyStubElementType CLASS_BODY = new EmptyStubElementType("class block", GroovyFileType.GROOVY_LANGUAGE) {
@Override
- public GrTypeDefinitionBody createPsi(EmptyStub stub) {
+ public GrTypeDefinitionBody createPsi(@NotNull EmptyStub stub) {
return new GrTypeDefinitionBodyBase.GrClassBody(stub);
}
};
@@ -402,14 +402,14 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
}
@Override
- public GrVariableDeclaration createPsi(EmptyStub stub) {
+ public GrVariableDeclaration createPsi(@NotNull EmptyStub stub) {
throw new UnsupportedOperationException("Not implemented");
}
};
EmptyStubElementType VARIABLE_DEFINITION =
new EmptyStubElementType("variable definitions", GroovyFileType.GROOVY_LANGUAGE) {
@Override
- public GrVariableDeclaration createPsi(EmptyStub stub) {
+ public GrVariableDeclaration createPsi(@NotNull EmptyStub stub) {
return new GrVariableDeclarationBase.GrVariables(stub);
}
};
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
index 3d7d4e055017..f35cc3c1e6f9 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
@@ -52,7 +52,6 @@ import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrClassInitializer;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
@@ -612,7 +611,7 @@ public abstract class GrTypeDefinitionImpl extends GrStubElementBase
super("field");
}
- public GrField createPsi(GrFieldStub stub) {
+ public GrField createPsi(@NotNull GrFieldStub stub) {
return new GrFieldImpl(stub);
}
- public GrFieldStub createStub(GrField psi, StubElement parentStub) {
+ public GrFieldStub createStub(@NotNull GrField psi, StubElement parentStub) {
String[] annNames = GrStubUtils.getAnnotationNames(psi);
Set namedParameters = Collections.emptySet();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrMethodElementType.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrMethodElementType.java
index f5b746cbef1b..380a3a18e739 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrMethodElementType.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrMethodElementType.java
@@ -20,6 +20,7 @@ import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.util.io.StringRef;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrMethodStub;
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrStubUtils;
@@ -38,7 +39,7 @@ public abstract class GrMethodElementType extends GrStubElementType namedParameters = psi.getNamedParameters().keySet();
return new GrMethodStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi),
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java
index d9e342616506..c3eb8999161d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrModifierListElementType.java
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.stubs.elements;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
import com.intellij.psi.stubs.StubOutputStream;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.modifiers.GrModifierListImpl;
@@ -34,12 +35,12 @@ public class GrModifierListElementType extends GrStubElementType exte
super(debugName);
}
- public GrReferenceListStub createStub(T psi, StubElement parentStub) {
+ public GrReferenceListStub createStub(@NotNull T psi, StubElement parentStub) {
List refNames = new ArrayList();
for (GrCodeReferenceElement element : psi.getReferenceElements()) {
final String name = element.getText();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeDefinitionElementType.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeDefinitionElementType.java
index 3abdb54889ee..d6d468845d25 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeDefinitionElementType.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/stubs/elements/GrTypeDefinitionElementType.java
@@ -42,7 +42,7 @@ public abstract class GrTypeDefinitionElementType collector) {
if (PsiImplUtil.getAnnotation(clazz, GroovyCommonClassNames.GROOVY_TRANSFORM_AUTO_CLONE) == null) return;
- final LightMethodBuilder clone = new LightMethodBuilder(clazz.getManager(), "clone");
+ final LightMethodBuilder clone = new LightMethodBuilder(clazz.getManager(), "clone").addModifier(PsiModifier.PUBLIC);
clone.setContainingClass(clazz);
clone.addException(CloneNotSupportedException.class.getName());
collector.add(clone);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ast/DelegatedMethodsContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ast/DelegatedMethodsContributor.java
index 2fc202956d5f..78faf0301610 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ast/DelegatedMethodsContributor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/ast/DelegatedMethodsContributor.java
@@ -57,6 +57,7 @@ public class DelegatedMethodsContributor extends AstTransformContributor {
for (PsiMethod method : methods) {
if (method.isConstructor()) continue;
if (!deprecated && PsiImplUtil.getAnnotation(method, "java.lang.Deprecated") != null) continue;
+ if (clazz.findCodeMethodsBySignature(method, false).length > 0) continue;
collector.add(generateDelegateMethod(method, clazz, resolveResult.getSubstitutor()));
}
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java
index 883140d6cb76..a0af4d23a3d1 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcConsole.java
@@ -294,7 +294,7 @@ public class MvcConsole implements Disposable {
catch (final IOException e) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
- Messages.showErrorDialog(e.getMessage(), "Cannot start process");
+ Messages.showErrorDialog(e.getMessage(), "Cannot Start Process");
try {
if (onDone != null && !module.isDisposed()) onDone.run();
@@ -359,7 +359,7 @@ public class MvcConsole implements Disposable {
super("Kill process", "Kill process", KILL_PROCESS_ICON);
}
- public void setHandler(OSProcessHandler handler) {
+ public void setHandler(@Nullable OSProcessHandler handler) {
myHandler = handler;
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java
index a19cbc645ab1..aa1ece9b1c31 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java
@@ -104,7 +104,7 @@ public abstract class GroovyRefactoringUtil {
}
@Nullable
- public static T findElementInRange(final GroovyFileBase file,
+ public static T findElementInRange(final PsiFile file,
int startOffset,
int endOffset,
final Class klass) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java
index c437d8b4aa39..472d6efe43a5 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/ConvertToJavaProcessor.java
@@ -20,14 +20,17 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.refactoring.BaseRefactoringProcessor;
+import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.ui.UsageViewDescriptorAdapter;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewDescriptor;
+import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.hash.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
@@ -93,7 +96,20 @@ public class ConvertToJavaProcessor extends BaseRefactoringProcessor {
document.setText(builder.toString());
PsiDocumentManager.getInstance(myProject).commitDocument(document);
String fileName = getNewFileName(file);
- PsiElement newFile = file.setName(fileName);
+ PsiElement newFile;
+ try {
+ newFile = file.setName(fileName);
+ }
+ catch (final IncorrectOperationException e) {
+ ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ Messages.showMessageDialog(myProject, e.getMessage(), RefactoringBundle.message("error.title"), Messages.getErrorIcon());
+ }
+ });
+ return;
+ }
+
if (ApplicationManager.getApplication().isUnitTestMode()) return;
// don't move classes to new files with corresponding class names and reformat
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extractMethod/ExtractMethodUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extractMethod/ExtractMethodUtil.java
index 7410da1ec93f..aa0cf3eb81d2 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extractMethod/ExtractMethodUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extractMethod/ExtractMethodUtil.java
@@ -74,8 +74,7 @@ public class ExtractMethodUtil {
}
startElement = startElement.getParent();
PsiElement parent = startElement.getParent();
- if (parent instanceof GroovyFile &&
- ((GroovyFile) parent).getScriptClass() == owner) {
+ if (parent instanceof GroovyFile && ((GroovyFile) parent).getScriptClass() == owner) {
return startElement.getNextSibling();
}
}
@@ -418,7 +417,7 @@ public class ExtractMethodUtil {
static PsiElement[] getElementsInOffset(PsiFile file, int startOffset, int endOffset) {
PsiElement[] elements;
- GrExpression expr = GroovyRefactoringUtil.findElementInRange(((GroovyFileBase) file), startOffset, endOffset, GrExpression.class);
+ GrExpression expr = GroovyRefactoringUtil.findElementInRange(file, startOffset, endOffset, GrExpression.class);
if (expr != null) {
PsiElement parent = expr.getParent();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java
index fe35c7081066..6ed7c8e88f1b 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java
@@ -42,7 +42,6 @@ import com.intellij.util.Processor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.codeInspection.utils.ControlFlowUtils;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
@@ -243,8 +242,8 @@ public abstract class GrIntroduceHandlerBase l = new AL
+ }
+}
\ No newline at end of file
diff --git a/plugins/groovy/testdata/groovy/completion/smart/InnerClassReferenceWithoutQualifier_after.groovy b/plugins/groovy/testdata/groovy/completion/smart/InnerClassReferenceWithoutQualifier_after.groovy
new file mode 100644
index 000000000000..c6d80a381f7a
--- /dev/null
+++ b/plugins/groovy/testdata/groovy/completion/smart/InnerClassReferenceWithoutQualifier_after.groovy
@@ -0,0 +1,6 @@
+class Foo {
+ static class Bar {}
+ {
+ List l = new ArrayList()
+ }
+}
\ No newline at end of file
diff --git a/plugins/groovy/testdata/groovy/stubGenerator/autoCloneAnno.test b/plugins/groovy/testdata/groovy/stubGenerator/autoCloneAnno.test
new file mode 100644
index 000000000000..fa785119a386
--- /dev/null
+++ b/plugins/groovy/testdata/groovy/stubGenerator/autoCloneAnno.test
@@ -0,0 +1,30 @@
+@groovy.transform.AutoClone
+class Foo {}
+-----
+public class Foo extends groovy.lang.GroovyObjectSupport implements groovy.lang.GroovyObject {
+public java.lang.Object clone() throws java.lang.CloneNotSupportedException {
+return null;
+}
+
+public java.lang.Object getProperty(java.lang.String property) {
+return null;
+}
+
+public void setProperty(java.lang.String property, java.lang.Object newValue) {
+return ;
+}
+
+public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args) {
+return null;
+}
+
+public groovy.lang.MetaClass getMetaClass() {
+return null;
+}
+
+public void setMetaClass(groovy.lang.MetaClass metaClass) {
+return ;
+}
+
+}
+---
\ No newline at end of file
diff --git a/plugins/groovy/testdata/groovy/stubGenerator/delegateAnno.test b/plugins/groovy/testdata/groovy/stubGenerator/delegateAnno.test
index 0a4eb4ce3447..2f202cdbdd9c 100644
--- a/plugins/groovy/testdata/groovy/stubGenerator/delegateAnno.test
+++ b/plugins/groovy/testdata/groovy/stubGenerator/delegateAnno.test
@@ -9,6 +9,10 @@ class DelegateBarImpl {
private @Delegate(interfaces=false) Runnable zoo;
private @Delegate Doo doo;
}
+class Del2 implements DelegateFoo {
+ @Delegate DelegateFoo foo;
+ def foo() {}
+}
-----
public interface DelegateFoo {
public java.lang.Object foo() ;
@@ -79,4 +83,40 @@ private DelegateFoo foo = null;
private java.lang.Runnable zoo = null;
private Doo doo = null;
}
+---
+public class Del2 extends groovy.lang.GroovyObjectSupport implements DelegateFoo, groovy.lang.GroovyObject {
+public java.lang.Object foo() {
+return null;
+}
+
+public DelegateFoo getFoo() {
+return null;
+}
+
+public void setFoo(DelegateFoo foo) {
+return ;
+}
+
+public java.lang.Object getProperty(java.lang.String property) {
+return null;
+}
+
+public void setProperty(java.lang.String property, java.lang.Object newValue) {
+return ;
+}
+
+public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args) {
+return null;
+}
+
+public groovy.lang.MetaClass getMetaClass() {
+return null;
+}
+
+public void setMetaClass(groovy.lang.MetaClass metaClass) {
+return ;
+}
+
+private DelegateFoo foo = null;
+}
---
\ No newline at end of file
diff --git a/plugins/properties/src/com/intellij/lang/properties/parsing/PropertyListStubElementType.java b/plugins/properties/src/com/intellij/lang/properties/parsing/PropertyListStubElementType.java
index 776e052b57f6..d3e46b694be8 100644
--- a/plugins/properties/src/com/intellij/lang/properties/parsing/PropertyListStubElementType.java
+++ b/plugins/properties/src/com/intellij/lang/properties/parsing/PropertyListStubElementType.java
@@ -24,6 +24,7 @@ import com.intellij.lang.properties.psi.PropertiesListStub;
import com.intellij.lang.properties.psi.impl.PropertiesListImpl;
import com.intellij.lang.properties.psi.impl.PropertiesListStubImpl;
import com.intellij.psi.stubs.*;
+import org.jetbrains.annotations.NotNull;
import java.io.IOException;
@@ -32,11 +33,11 @@ public class PropertyListStubElementType extends IStubElementType {
}
initLogFilters();
- // Alexander Kitaev says it is default value (empty string)
- if (System.getProperty(SVNKIT_HTTP_SSL_PROTOCOLS) == null) {
- System.setProperty(SVNKIT_HTTP_SSL_PROTOCOLS, "");
+ // Alexander Kitaev says it is default value (SSLv3) - since 8254
+ if (! SystemInfo.JAVA_RUNTIME_VERSION.startsWith("1.7") && System.getProperty(SVNKIT_HTTP_SSL_PROTOCOLS) == null) {
+ System.setProperty(SVNKIT_HTTP_SSL_PROTOCOLS, "SSLv3");
}
}
diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml
index c2f291d22407..40d705ba42b6 100644
--- a/resources/src/META-INF/IdeaPlugin.xml
+++ b/resources/src/META-INF/IdeaPlugin.xml
@@ -548,7 +548,7 @@
Control Flow
- com.intellij.codeInsight.intention.impl.DeannotateIntentionAction ยก
+ com.intellij.codeInsight.intention.impl.DeannotateIntentionAction
Control Flow