Merge branch 'master' of git@git.labs.intellij.net:idea/community
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
@@ -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();
|
||||
|
||||
@@ -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<VirtualFile> getArtifactOutputsContainingSourceFiles(final @NotNull Project project) {
|
||||
final List<VirtualFile> allOutputs = new ArrayList<VirtualFile>();
|
||||
for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
|
||||
ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);
|
||||
}
|
||||
|
||||
final Set<VirtualFile> affectedOutputPaths = new HashSet<VirtualFile>();
|
||||
final PackagingElementResolvingContext context = ArtifactManager.getInstance(project).getResolvingContext();
|
||||
for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
|
||||
ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
@@ -230,6 +230,8 @@ public class CodeInsightUtil {
|
||||
}, new Comparator<PsiElement>() {
|
||||
@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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,12 +48,12 @@ public class JavaAnnotationElementType extends JavaStubElementType<PsiAnnotation
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiAnnotation createPsi(final PsiAnnotationStub stub) {
|
||||
public PsiAnnotation createPsi(@NotNull final PsiAnnotationStub stub) {
|
||||
return getPsiFactory(stub).createAnnotation(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiAnnotation createPsi(final ASTNode node) {
|
||||
public PsiAnnotation createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiAnnotationImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ public abstract class JavaClassElementType extends JavaStubElementType<PsiClassS
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClass createPsi(final PsiClassStub stub) {
|
||||
public PsiClass createPsi(@NotNull final PsiClassStub stub) {
|
||||
return getPsiFactory(stub).createClass(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClass createPsi(final ASTNode node) {
|
||||
public PsiClass createPsi(@NotNull final ASTNode node) {
|
||||
if (node instanceof EnumConstantInitializerElement) {
|
||||
return new PsiEnumConstantInitializerImpl(node);
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ public class JavaClassInitializerElementType extends JavaStubElementType<PsiClas
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClassInitializer createPsi(final PsiClassInitializerStub stub) {
|
||||
public PsiClassInitializer createPsi(@NotNull final PsiClassInitializerStub stub) {
|
||||
return getPsiFactory(stub).createClassInitializer(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClassInitializer createPsi(final ASTNode node) {
|
||||
public PsiClassInitializer createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiClassInitializerImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@ public abstract class JavaClassReferenceListElementType extends JavaStubElementT
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiReferenceList createPsi(final PsiClassReferenceListStub stub) {
|
||||
public PsiReferenceList createPsi(@NotNull final PsiClassReferenceListStub stub) {
|
||||
return getPsiFactory(stub).createClassReferenceList(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiReferenceList createPsi(final ASTNode node) {
|
||||
public PsiReferenceList createPsi(@NotNull final ASTNode node) {
|
||||
if (node.getElementType() == JavaStubElementTypes.EXTENDS_BOUND_LIST) {
|
||||
return new PsiTypeParameterExtendsBoundsListImpl(node);
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ public abstract class JavaFieldStubElementType extends JavaStubElementType<PsiFi
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiField createPsi(final PsiFieldStub stub) {
|
||||
public PsiField createPsi(@NotNull final PsiFieldStub stub) {
|
||||
return getPsiFactory(stub).createField(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiField createPsi(final ASTNode node) {
|
||||
public PsiField createPsi(@NotNull final ASTNode node) {
|
||||
if (node instanceof EnumConstantElement) {
|
||||
return new PsiEnumConstantImpl(node);
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ public class JavaImportListElementType extends JavaStubElementType<PsiImportList
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiImportList createPsi(final PsiImportListStub stub) {
|
||||
public PsiImportList createPsi(@NotNull final PsiImportListStub stub) {
|
||||
return getPsiFactory(stub).createImportList(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiImportList createPsi(final ASTNode node) {
|
||||
public PsiImportList createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiImportListImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ public abstract class JavaImportStatementElementType extends JavaStubElementType
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiImportStatementBase createPsi(final PsiImportStatementStub stub) {
|
||||
public PsiImportStatementBase createPsi(@NotNull final PsiImportStatementStub stub) {
|
||||
return getPsiFactory(stub).createImportStatement(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiImportStatementBase createPsi(final ASTNode node) {
|
||||
public PsiImportStatementBase createPsi(@NotNull final ASTNode node) {
|
||||
if (node instanceof ImportStaticStatementElement) {
|
||||
return new PsiImportStaticStatementImpl(node);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.psi.stubs.StubOutputStream;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -51,12 +52,12 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiMethod createPsi(final PsiMethodStub stub) {
|
||||
public PsiMethod createPsi(@NotNull final PsiMethodStub stub) {
|
||||
return getPsiFactory(stub).createMethod(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiMethod createPsi(final ASTNode node) {
|
||||
public PsiMethod createPsi(@NotNull final ASTNode node) {
|
||||
if (node instanceof AnnotationMethodElement) {
|
||||
return new PsiAnnotationMethodImpl(node);
|
||||
}
|
||||
|
||||
@@ -48,12 +48,12 @@ public class JavaModifierListElementType extends JavaStubElementType<PsiModifier
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiModifierList createPsi(final PsiModifierListStub stub) {
|
||||
public PsiModifierList createPsi(@NotNull final PsiModifierListStub stub) {
|
||||
return getPsiFactory(stub).createModifierList(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiModifierList createPsi(final ASTNode node) {
|
||||
public PsiModifierList createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiModifierListImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,12 @@ public class JavaParameterElementType extends JavaStubElementType<PsiParameterSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiParameter createPsi(final PsiParameterStub stub) {
|
||||
public PsiParameter createPsi(@NotNull PsiParameterStub stub) {
|
||||
return getPsiFactory(stub).createParameter(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiParameter createPsi(final ASTNode node) {
|
||||
public PsiParameter createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiParameterImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ public class JavaParameterListElementType extends JavaStubElementType<PsiParamet
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiParameterList createPsi(final PsiParameterListStub stub) {
|
||||
public PsiParameterList createPsi(@NotNull final PsiParameterListStub stub) {
|
||||
return getPsiFactory(stub).createParameterList(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiParameterList createPsi(final ASTNode node) {
|
||||
public PsiParameterList createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiParameterListImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ public abstract class JavaStubElementType<StubT extends StubElement, PsiT extend
|
||||
}
|
||||
|
||||
@SuppressWarnings("MethodOverloadsMethodOfSuperclass")
|
||||
public abstract PsiT createPsi(ASTNode node);
|
||||
public abstract PsiT createPsi(@NotNull ASTNode node);
|
||||
|
||||
@Override
|
||||
public final StubT createStub(final PsiT psi, final StubElement parentStub) {
|
||||
public final StubT createStub(@NotNull final PsiT psi, final StubElement parentStub) {
|
||||
final String message = "Should not be called. Element=" + psi + "; file=" + (psi.isValid() ? psi.getContainingFile() : "-");
|
||||
throw new UnsupportedOperationException(message);
|
||||
}
|
||||
|
||||
@@ -49,12 +49,12 @@ public class JavaTypeParameterElementType extends JavaStubElementType<PsiTypePar
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiTypeParameter createPsi(final PsiTypeParameterStub stub) {
|
||||
public PsiTypeParameter createPsi(@NotNull final PsiTypeParameterStub stub) {
|
||||
return getPsiFactory(stub).createTypeParameter(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiTypeParameter createPsi(final ASTNode node) {
|
||||
public PsiTypeParameter createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiTypeParameterImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ public class JavaTypeParameterListElementType extends JavaStubElementType<PsiTyp
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiTypeParameterList createPsi(final PsiTypeParameterListStub stub) {
|
||||
public PsiTypeParameterList createPsi(@NotNull final PsiTypeParameterListStub stub) {
|
||||
return getPsiFactory(stub).createTypeParameterList(stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiTypeParameterList createPsi(final ASTNode node) {
|
||||
public PsiTypeParameterList createPsi(@NotNull final ASTNode node) {
|
||||
return new PsiTypeParameterListImpl(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public abstract class JavaStubPsiElement<T extends StubElement> extends StubBasedPsiElementBase<T> implements StubBasedPsiElement<T> {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ public class PsiParameterImpl extends JavaStubPsiElement<PsiParameterStub> imple
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiParameterImpl");
|
||||
private volatile PatchedSoftReference<PsiType> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class PsiParameterListImpl extends JavaStubPsiElement<PsiParameterListStub> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -32,9 +32,9 @@ public abstract class IStubElementType<StubT extends StubElement, PsiT extends P
|
||||
super(debugName, language);
|
||||
}
|
||||
|
||||
public abstract PsiT createPsi(StubT stub);
|
||||
public abstract PsiT createPsi(@NotNull StubT stub);
|
||||
|
||||
public abstract StubT createStub(PsiT psi, final StubElement parentStub);
|
||||
public abstract StubT createStub(@NotNull PsiT psi, final StubElement parentStub);
|
||||
|
||||
public boolean shouldCreateStub(ASTNode node) {
|
||||
return true;
|
||||
|
||||
@@ -441,7 +441,7 @@ public class CodeEditUtil {
|
||||
* <ol>
|
||||
* <li>This method is called with <code>'false'</code> argument;</li>
|
||||
* <li>Document is processed at dedicated <code>'try'</code> block;</li>
|
||||
* <li>This method is called with <code>'false'</code> argument from <code>'finally'</code> section;</li>
|
||||
* <li>This method is called with <code>'true'</code> argument from <code>'finally'</code> section;</li>
|
||||
* </ol>
|
||||
</pre>
|
||||
*/
|
||||
|
||||
|
After Width: | Height: | Size: 945 B |
@@ -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();
|
||||
|
||||
@@ -17,7 +17,7 @@ public abstract class EmptyStubElementType<T extends PsiElement> extends IStubEl
|
||||
}
|
||||
|
||||
@Override
|
||||
public final EmptyStub createStub(T psi, StubElement parentStub) {
|
||||
public final EmptyStub createStub(@NotNull T psi, StubElement parentStub) {
|
||||
return createStub(parentStub);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,11 @@ public class InitialConfigurationDialog extends DialogWrapper {
|
||||
return myHidingPreviewPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initOnImpl() {
|
||||
//?
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpl() {
|
||||
myWrapper.setVisible(true);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -37,58 +37,73 @@ import java.lang.ref.WeakReference;
|
||||
|
||||
public class ShowContainerInfoHandler implements CodeInsightActionHandler {
|
||||
private static final Key<WeakReference<LightweightHint>> MY_LAST_HINT_KEY = Key.create("MY_LAST_HINT_KEY");
|
||||
private static final Key<PsiElement> 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<LightweightHint> 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<LightweightHint>(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<LightweightHint>(hint));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean startInWriteAction() {
|
||||
|
||||
@@ -36,6 +36,7 @@ public class EndHandler extends EditorActionHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
lookup.markSelectionTouched();
|
||||
ListScrollingUtil.moveEnd(lookup.getList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class HomeHandler extends EditorActionHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
lookup.markSelectionTouched();
|
||||
ListScrollingUtil.moveHome(lookup.getList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ConsoleViewImpl> CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW");
|
||||
public static final Key<ConsoleViewImpl> CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW");
|
||||
|
||||
static {
|
||||
final EditorActionManager actionManager = EditorActionManager.getInstance();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<AbstractTreeNode> getChildren() {
|
||||
final Module module = getValue();
|
||||
if (module == null) {
|
||||
// just deleted a module from project view
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>(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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -469,13 +469,17 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
}
|
||||
|
||||
myOccurrenceMarkers = null;
|
||||
if (psiField.isValid()) {
|
||||
psiField.delete();
|
||||
}
|
||||
deleteTemplateField(psiField);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void deleteTemplateField(V psiField) {
|
||||
if (psiField.isValid()) {
|
||||
psiField.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void moveOffsetAfter(boolean success) {
|
||||
if (success) {
|
||||
|
||||
@@ -20,10 +20,13 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.impl.ProjectLifecycleListener;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.HashMap;
|
||||
@@ -42,6 +45,12 @@ public class IconDeferrerImpl extends IconDeferrer {
|
||||
clear();
|
||||
}
|
||||
});
|
||||
connection.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener.Adapter() {
|
||||
@Override
|
||||
public void afterProjectClosed(@NotNull Project project) {
|
||||
clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupEx;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.editor.impl.EditorComponentImpl;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -36,22 +40,12 @@ public class UpDownHandler {
|
||||
register(input, affectedComponent, true);
|
||||
}
|
||||
|
||||
public static void register(JComponent input, final JComponent affectedComponent, boolean registerOnBothComponents) {
|
||||
public static void register(final JComponent input, final JComponent affectedComponent, boolean registerOnBothComponents) {
|
||||
final SelectionMover mover = new SelectionMover(affectedComponent);
|
||||
final AnAction up = new AnAction("Up") {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
mover.move(-1);
|
||||
}
|
||||
};
|
||||
final AnAction up = new UpDownAction(mover, input, true);
|
||||
up.registerCustomShortcutSet(UP_KEY, input);
|
||||
|
||||
final AnAction down = new AnAction("Down") {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
mover.move(1);
|
||||
}
|
||||
};
|
||||
|
||||
final AnAction down = new UpDownAction(mover, input, false);
|
||||
down.registerCustomShortcutSet(DOWN_KEY, input);
|
||||
if (registerOnBothComponents) {
|
||||
up.registerCustomShortcutSet(UP_KEY, affectedComponent);
|
||||
@@ -103,4 +97,36 @@ public class UpDownHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class UpDownAction extends AnAction {
|
||||
private final int myDirection;
|
||||
private final SelectionMover myMover;
|
||||
private final JComponent myInput;
|
||||
|
||||
UpDownAction(SelectionMover mover, JComponent input, boolean isUp) {
|
||||
super(isUp ? "Up" : "Down");
|
||||
myMover = mover;
|
||||
myInput = input;
|
||||
myDirection = isUp ? -1 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
myMover.move(myDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
final LookupEx lookup;
|
||||
if (myInput instanceof EditorTextField) {
|
||||
lookup = LookupManager.getActiveLookup(((EditorTextField)myInput).getEditor());
|
||||
} else if (myInput instanceof EditorComponentImpl) {
|
||||
lookup = LookupManager.getActiveLookup(((EditorComponentImpl)myInput).getEditor());
|
||||
} else {
|
||||
lookup = null;
|
||||
}
|
||||
|
||||
e.getPresentation().setEnabled(lookup == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide.wizard;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
@@ -37,6 +38,7 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -113,10 +115,11 @@ public abstract class AbstractWizard<T extends Step> 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<T extends Step> extends DialogWrapper {
|
||||
leftPanel.add(myHelpButton);
|
||||
}
|
||||
leftPanel.add(myCancelButton);
|
||||
|
||||
panel.add(leftPanel, BorderLayout.WEST);
|
||||
|
||||
buttonPanel.add(myFinishButton);
|
||||
@@ -139,20 +141,31 @@ public abstract class AbstractWizard<T extends Step> 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<Component> 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<T extends Step> extends DialogWrapper {
|
||||
return panel;
|
||||
}
|
||||
|
||||
private static void add(final GroupLayout.Group hGroup,
|
||||
final GroupLayout.Group vGroup,
|
||||
@Nullable final Collection<Component> 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<T extends Step> 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++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<String,Transferable> 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<Transferable> result = new Ref<Transferable>();
|
||||
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();
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -40,6 +40,7 @@ class DiffSplitter extends Splitter implements DiffSplitterI {
|
||||
setDividerWidth(30);
|
||||
setFirstComponent(component1);
|
||||
setSecondComponent(component2);
|
||||
setHonorComponentsMinimumSize(false);
|
||||
}
|
||||
|
||||
protected Splitter.Divider createDivider() {
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<WatchRequestImpl> result = new ArrayList<WatchRequestImpl>();
|
||||
|
||||
// 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<WatchRequest>() {
|
||||
@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<WatchRequest> addRootsToWatch(@NotNull final Collection<String> rootPaths, final boolean toWatchRecursively) {
|
||||
if (!FileWatcher.getInstance().isOperational()) return Collections.emptySet();
|
||||
|
||||
Set<WatchRequest> result = new HashSet<WatchRequest>();
|
||||
Set<VirtualFile> filesToSynchronize = new HashSet<VirtualFile>();
|
||||
final Set<WatchRequest> result = new HashSet<WatchRequest>();
|
||||
final Set<VirtualFile> filesToSynchronize = new HashSet<VirtualFile>();
|
||||
|
||||
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<WatchRequest> 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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<IdeaPluginDescriptor> pluginsComparator = new Comparator<IdeaPluginDescriptor>() {
|
||||
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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Integer> 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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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=<html>Manage external JavaDocs attached to this module. External JavaDoc override JavaDoc annotations you might have in your module.</html>
|
||||
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=<html><body>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=<html>Manage external annotations attached to this module.</html>
|
||||
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
|
||||
|
||||
|
||||
@@ -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
|
||||
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
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<p>To quickly find a menu command or toolbar action, you do not need to look through the menus. Just press
|
||||
<span class="shortcut">&shortcut:GotoAction;</span>
|
||||
(<span class="control">Go To | Action</span> on the main
|
||||
(<span class="control">Help | Find Action</span> on the main
|
||||
menu) and start typing the name of the action. Choose the desired action from the suggestion list.</p>
|
||||
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
<body>
|
||||
<p>
|
||||
To open any class in the editor quickly, press <span class="shortcut">&shortcut:GotoClass;</span>
|
||||
(<span class="control">Go To | Class</span>)
|
||||
(<span class="control">Navigate | Class</span>)
|
||||
and start typing the name of the class. Choose the class from a drop-down list that appears.</p>
|
||||
<p class="image">
|
||||
<img src="images/goto_class.gif"></p>
|
||||
<p>
|
||||
You can open any file in your project in a similar way by using <span class="shortcut">&shortcut:GotoFile;</span>
|
||||
(<span class="control">Go To | File</span>)</p>
|
||||
(<span class="control">Navigate | File</span>)</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
<body>
|
||||
|
||||
|
||||
<p>To quickly find and run an inspection press
|
||||
<p>To quickly find and run an inspection, press
|
||||
<span class="shortcut">&shortcut:RunInspection;</span>
|
||||
(<span class="control">Go To | Inspection</span> 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.</p>
|
||||
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.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
<p>To open any particular method or field in the editor quickly, press <span class="shortcut">&shortcut:GotoSymbol;</span>
|
||||
(<span class="control">Go To | Symbol</span>)
|
||||
(<span class="control">Navigate | Symbol</span>)
|
||||
and start typing its name.</p>
|
||||
<p>Choose the symbol from a drop-down list that appears.</p>
|
||||
<p class="image"><img src="images/goto_symbol.gif"></p>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<body>
|
||||
<p>
|
||||
To open any class or file in the editor at the desired line, press <span class="shortcut">&shortcut:GotoFile;</span>
|
||||
(<span class="control">Go To | File</span>),
|
||||
(<span class="control">Navigate | File</span>),
|
||||
start typing the name, and choose the one from the suggestion list.
|
||||
Then type the colon (<span class="code_emphasis">:</span>) and a line number.</p>
|
||||
<p>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<body>
|
||||
|
||||
|
||||
<p>Use <span class="shortcut">&shortcut:HighlightUsagesInFile;</span> (<span class="control">Search | Highlight Usages in File</span>)
|
||||
<p>Use <span class="shortcut">&shortcut:HighlightUsagesInFile;</span> (<span class="control">Edit | Find | Highlight Usages in File</span>)
|
||||
to quickly highlight usages of some variable in the current file.</p>
|
||||
<p>Use <span class="shortcut">&shortcut:FindNext;</span> and <span class="shortcut">&shortcut:FindPrevious;</span> keys to navigate through highlighted usages.</p>
|
||||
<p>Press <span class="shortcut">&shortcut:EditorEscape;</span> to remove the highlighting.</p>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<body>
|
||||
|
||||
|
||||
<p><span class="shortcut">&shortcut:JumpToLastChange;</span> (<span class="control">Go To | Last Edit Location</span>)
|
||||
<p><span class="shortcut">&shortcut:JumpToLastChange;</span> (<span class="control">Navigate | Last Edit Location</span>)
|
||||
brings you back to the last place where you made changes in the code.</p>
|
||||
<p>Pressing <span class="shortcut">&shortcut:JumpToLastChange;</span> a few times moves you deeper into your changes history.</p>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<p>The shortcuts such as <span class="shortcut">&shortcut:QuickJavaDoc;</span>
|
||||
(<span class="control">View | Quick Documentation</span>),
|
||||
<span class="shortcut">&shortcut:ParameterInfo;</span> (<span class="control">View | Parameter Info</span>),
|
||||
<span class="shortcut">&shortcut:GotoDeclaration;</span> (<span class="control">Go To | Declaration</span>)
|
||||
<span class="shortcut">&shortcut:GotoDeclaration;</span> (<span class="control">Navigate | Declaration</span>)
|
||||
and others can be used not only in the editor but in the code completion popup list as well.</p>
|
||||
<p class="image"><img src="images/quick_javadoc_in_lookups.gif"></p>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<p>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 <span class="shortcut">&shortcut:ShowUsages;</span> (<span class="control">Search | Show Usages</span>
|
||||
in code and press <span class="shortcut">&shortcut:ShowUsages;</span> (<span class="control">Edit | Find | Show Usages</span>
|
||||
in the main menu), scroll the list and click the desired usage.</p>
|
||||
<p class="image"><img src="images/showUsages.png"/></p>
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
<p>For the pattern search in the <span class="control">Go to Class</span>,
|
||||
<span class="control">Go to Symbol</span> and
|
||||
<span class="control">Go to File</span> popups,
|
||||
you can use <span class="code_emphasis">*</span> and space symbols.</p>
|
||||
<span class="control">Go to File</span> pop-up frames,
|
||||
use <span class="code_emphasis">*</span> and space symbols.</p>
|
||||
<p><span class="code_emphasis">*</span> stands for any symbol.</p>
|
||||
<p>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.</p>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<AbstractVcs, JPanel> myPerVcsOptionsPanels = new HashMap<AbstractVcs, JPanel>();
|
||||
@@ -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<Integer>() {
|
||||
@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<AbstractVcs> getAffectedVcses() {
|
||||
|
||||
@@ -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<Range>();
|
||||
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) {
|
||||
|
||||