Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Eugene Kudelevsky
2010-10-08 18:37:14 +04:00
50 changed files with 442 additions and 252 deletions
@@ -520,29 +520,25 @@ public class BackendCompilerWrapper {
final List<File> toRefresh = new ArrayList<File>();
final Map<String, Collection<TranslatingCompiler.OutputItem>> results = new HashMap<String, Collection<TranslatingCompiler.OutputItem>>();
try {
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
final FileTypeManager typeManager = FileTypeManager.getInstance();
final String outputDirPath = outputDir.replace(File.separatorChar, '/');
try {
for (final Module module : chunk.getModules()) {
for (final VirtualFile root : chunk.getSourceRoots(module)) {
final String packagePrefix = myProjectFileIndex.getPackageNameByDirectory(root);
if (LOG.isDebugEnabled()) {
LOG.debug("Building output items for " + root.getPresentableUrl() + "; output dir = " + outputDirPath + "; packagePrefix = \"" + packagePrefix + "\"");
}
buildOutputItemsList(outputDirPath, module, root, typeManager, root, packagePrefix, toRefresh, results);
}
}
}
catch (CacheCorruptedException e) {
myCompileContext.requestRebuildNextTime(CompilerBundle.message("error.compiler.caches.corrupted"));
final FileTypeManager typeManager = FileTypeManager.getInstance();
final String outputDirPath = outputDir.replace(File.separatorChar, '/');
try {
for (final Module module : chunk.getModules()) {
for (final VirtualFile root : chunk.getSourceRoots(module)) {
final String packagePrefix = myProjectFileIndex.getPackageNameByDirectory(root);
if (LOG.isDebugEnabled()) {
LOG.debug(e);
LOG.debug("Building output items for " + root.getPresentableUrl() + "; output dir = " + outputDirPath + "; packagePrefix = \"" + packagePrefix + "\"");
}
buildOutputItemsList(outputDirPath, module, root, typeManager, root, packagePrefix, toRefresh, results);
}
}
});
}
catch (CacheCorruptedException e) {
myCompileContext.requestRebuildNextTime(CompilerBundle.message("error.compiler.caches.corrupted"));
if (LOG.isDebugEnabled()) {
LOG.debug(e);
}
}
}
finally {
CompilerUtil.refreshIOFiles(toRefresh);
@@ -617,11 +613,11 @@ public class BackendCompilerWrapper {
paths.add(new CompiledClass(classQName, relativePathToSource, pathToClass));
}
private void updateOutputItemsList(final String outputDir, VirtualFile srcFile,
private void updateOutputItemsList(final String outputDir, final VirtualFile srcFile,
VirtualFile sourceRoot,
final String packagePrefix, final List<File> filesToRefresh,
Map<String, Collection<TranslatingCompiler.OutputItem>> results,
GlobalSearchScope srcRootScope) throws CacheCorruptedException {
final GlobalSearchScope srcRootScope) throws CacheCorruptedException {
final Cache newCache = myCompileContext.getDependencyCache().getNewClassesCache();
final Set<CompiledClass> paths = myFileNameToSourceMap.get(srcFile.getName());
if (paths == null || paths.isEmpty()) {
@@ -638,19 +634,24 @@ public class BackendCompilerWrapper {
if (!pathsEquals) {
final String qName = myCompileContext.getDependencyCache().resolve(cc.qName);
if (qName != null) {
final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject);
PsiClass psiClass = facade.findClass(qName, srcRootScope);
if (psiClass == null) {
final int dollarIndex = qName.indexOf("$");
if (dollarIndex >= 0) {
final String topLevelClassName = qName.substring(0, dollarIndex);
psiClass = facade.findClass(topLevelClassName, srcRootScope);
pathsEquals = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
public Boolean compute() {
final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject);
PsiClass psiClass = facade.findClass(qName, srcRootScope);
if (psiClass == null) {
final int dollarIndex = qName.indexOf("$");
if (dollarIndex >= 0) {
final String topLevelClassName = qName.substring(0, dollarIndex);
psiClass = facade.findClass(topLevelClassName, srcRootScope);
}
}
if (psiClass != null) {
final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile();
return vFile != null && vFile.equals(srcFile);
}
return false;
}
}
if (psiClass != null) {
final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile();
pathsEquals = vFile != null && vFile.equals(srcFile);
}
});
}
}
+1
View File
@@ -26,6 +26,7 @@
<orderEntry type="module" module-name="vcs-impl" />
<orderEntry type="module" module-name="icons" />
<orderEntry type="library" name="jcip" level="project" />
<orderEntry type="library" name="Groovy" level="project" />
</component>
<component name="copyright">
<Base>
@@ -602,7 +602,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
final PsiClass parentClass = method.getContainingClass();
if (parentClass != null) {
MethodReferencesSearch.search(new MethodReferencesSearch.SearchParameters(method, searchScope, !((JavaMethodFindUsagesOptions)options).isIncludeOverloadUsages, options.fastTrack)).forEach(new ReadActionProcessor<PsiReference>() {
MethodReferencesSearch.search(new MethodReferencesSearch.SearchParameters(method, searchScope, options instanceof JavaMethodFindUsagesOptions ? !((JavaMethodFindUsagesOptions)options).isIncludeOverloadUsages : true, options.fastTrack)).forEach(new ReadActionProcessor<PsiReference>() {
public boolean processInReadAction(final PsiReference ref) {
return addResult(result, ref, options);
}
@@ -15,6 +15,7 @@
*/
package com.intellij.refactoring.changeSignature;
import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.command.WriteCommandAction;
@@ -23,11 +24,14 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.PsiSearchHelper;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.util.CanonicalTypes;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.IncorrectOperationException;
@@ -65,7 +69,11 @@ public class JavaChangeSignatureDetector implements LanguageChangeSignatureDetec
}
final MyJavaChangeInfo fromMethod = new MyJavaChangeInfo(newVisibility, method, newReturnType, parameterInfos, null, method.getName());
if (changeInfo == null) { //before replacement
fromMethod.setSuperMethod(method.findDeepestSuperMethod());
final PsiMethod deepestSuperMethod = method.findDeepestSuperMethod();
if (deepestSuperMethod != null) {
if (!deepestSuperMethod.getManager().isInProject(deepestSuperMethod)) return null;
}
fromMethod.setSuperMethod(deepestSuperMethod);
return fromMethod;
} else {
final MyJavaChangeInfo info = (MyJavaChangeInfo)changeInfo;
-1
View File
@@ -18,7 +18,6 @@
<orderEntry type="module" module-name="vcs-impl" />
<orderEntry type="module" module-name="platform-impl" exported="" />
<orderEntry type="module" module-name="usageView" exported="" />
<orderEntry type="library" name="Groovy" level="project" />
<orderEntry type="library" name="Guava" level="project" />
</component>
</module>
@@ -111,8 +111,8 @@ public class DaemonTooltipRendererProvider implements ErrorStripTooltipRendererP
}
@Override
public TrafficTooltipRenderer createTrafficTooltipRenderer(Runnable onHide) {
return new TrafficTooltipRendererImpl(onHide);
public TrafficTooltipRenderer createTrafficTooltipRenderer(Runnable onHide, Editor editor) {
return new TrafficTooltipRendererImpl(onHide, editor);
}
private static class MyRenderer extends LineTooltipRenderer {
@@ -21,17 +21,20 @@ import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.ui.HintHint;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.ui.components.panels.VerticalBox;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.hash.LinkedHashMap;
import com.intellij.util.ui.AwtVisitor;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.util.ArrayList;
import java.util.Map;
@@ -39,18 +42,34 @@ import java.util.Map;
* User: cdr
*/
public class TrafficProgressPanel extends JPanel {
private static final int MAX = 100;
private static final String MAX_TEXT = "100%";
private static final String MIN_TEXT = "0%";
private final JLabel statistics = new JLabel();
private final Map<ProgressableTextEditorHighlightingPass, Pair<JProgressBar, JLabel>> passes = new LinkedHashMap<ProgressableTextEditorHighlightingPass, Pair<JProgressBar, JLabel>>();
private Map<JProgressBar, JLabel> myProgressToText = new HashMap<JProgressBar, JLabel>();
private final JLabel statusLabel = new JLabel();
private final TrafficLightRenderer myTrafficLightRenderer;
private final JPanel passStatuses = new JPanel();
private HintHint myHintHint;
public TrafficProgressPanel(TrafficLightRenderer trafficLightRenderer, Editor editor, HintHint hintHint) {
super(new VerticalFlowLayout());
myHintHint = hintHint;
myTrafficLightRenderer = trafficLightRenderer;
add(statusLabel);
setLayout(new BorderLayout());
VerticalBox center = new VerticalBox();
add(center, BorderLayout.NORTH);
center.add(statusLabel);
center.add(new Separator());
center.add(Box.createVerticalStrut(6));
TrafficLightRenderer.DaemonCodeAnalyzerStatus fakeStatusLargeEnough = new TrafficLightRenderer.DaemonCodeAnalyzerStatus();
fakeStatusLargeEnough.errorCount = new int[]{1,1,1,1};
Project project = trafficLightRenderer.getProject();
@@ -70,63 +89,103 @@ public class TrafficProgressPanel extends JPanel {
rebuildPassesPanel(fakeStatusLargeEnough);
for (Pair<JProgressBar, JLabel> pair : passes.values()) {
JProgressBar bar = pair.first;
bar.setMaximum(100);
bar.setMaximum(MAX);
JLabel label = pair.second;
label.setText("100%");
label.setText(MAX_TEXT);
}
add(passStatuses);
center.add(passStatuses);
add(statistics);
add(statistics, BorderLayout.SOUTH);
updatePanel(fakeStatusLargeEnough);
hintHint.initStyle(this, true);
}
private class Separator extends NonOpaquePanel {
@Override
protected void paintComponent(Graphics g) {
Insets insets = getInsets();
if (insets == null) {
insets = new Insets(0, 0, 0, 0);
}
g.setColor(myHintHint.getTextForeground());
g.drawLine(insets.left, insets.top, getWidth() - insets.left - insets.right, insets.top);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(1, 1);
}
@Override
public Dimension getMinimumSize() {
return new Dimension(1, 1);
}
}
private void rebuildPassesPanel(TrafficLightRenderer.DaemonCodeAnalyzerStatus status) {
passStatuses.removeAll();
passStatuses.setLayout(new GridLayoutManager(Math.max(status.passStati.size(),1), 3));
passStatuses.setLayout(new GridBagLayout());
passes.clear();
GridConstraints constraints = new GridConstraints();
GridBagConstraints c = new GridBagConstraints();
c.gridy = 0;
c.fill = GridBagConstraints.HORIZONTAL;
for (ProgressableTextEditorHighlightingPass pass : status.passStati) {
JLabel label = new JLabel(pass.getPresentableName() + ":");
JProgressBar progressBar = new JProgressBar(0,100);
JLabel label = new JLabel(pass.getPresentableName() + ": ");
label.setHorizontalTextPosition(JLabel.RIGHT);
JProgressBar progressBar = new JProgressBar(0, MAX);
progressBar.putClientProperty("JComponent.sizeVariant", "mini");
JLabel percLabel = new JLabel();
passes.put(pass, Pair.create(progressBar, percLabel));
constraints.setColumn(0); passStatuses.add(label, constraints);
constraints.setColumn(1); passStatuses.add(progressBar, constraints);
constraints.setColumn(2); passStatuses.add(percLabel, constraints);
constraints.setRow(constraints.getRow()+1);
myProgressToText.put(progressBar, percLabel);
c.gridx = 0;
passStatuses.add(label, c);
c.gridx = 1;
passStatuses.add(progressBar, c);
c.gridx = 2;
c.weightx = 1;
passStatuses.add(percLabel, c);
c.gridy++;
}
myHintHint.initStyle(passStatuses, true);
statusLabel.setFont(statusLabel.getFont().deriveFont(Font.BOLD));
}
public void updatePanel(TrafficLightRenderer.DaemonCodeAnalyzerStatus status) {
if (status == null) return;
if (PowerSaveMode.isEnabled()) {
statusLabel.setText("Code analysis is disabled in power save mode.");
statusLabel.setText("Code analysis is disabled in power save mode");
passStatuses.setVisible(false);
statistics.setText("");
return;
}
if (!status.enabled) {
statusLabel.setText("Code analysis has been suspended.");
passStatuses.setVisible(false);
statusLabel.setText("Code analysis has been suspended");
passStatuses.setVisible(true);
setPassesEnabled(false, Boolean.FALSE);
statistics.setText("");
return;
}
if (status.noHighlightingRoots != null && status.noHighlightingRoots.length == status.rootsNumber) {
statusLabel.setText(DaemonBundle.message("analysis.hasnot.been.run"));
passStatuses.setVisible(false);
passStatuses.setVisible(true);
setPassesEnabled(false, Boolean.FALSE);
statistics.setText("");
return;
}
if (status.errorAnalyzingFinished) {
statusLabel.setText(DaemonBundle.message("analysis.completed"));
passStatuses.setVisible(false);
passStatuses.setVisible(true);
setPassesEnabled(false, Boolean.TRUE);
}
else {
statusLabel.setText(DaemonBundle.message("performing.code.analysis"));
passStatuses.setVisible(true);
setPassesEnabled(true, null);
if (!status.passStati.equals(new ArrayList<ProgressableTextEditorHighlightingPass>(passes.keySet()))) {
// passes set has changed
@@ -137,7 +196,7 @@ public class TrafficProgressPanel extends JPanel {
double progress = pass.getProgress();
Pair<JProgressBar, JLabel> pair = passes.get(pass);
JProgressBar progressBar = pair.first;
int percent = (int)Math.round(progress * 100);
int percent = (int)Math.round(progress * MAX);
progressBar.setValue(percent);
JLabel percentage = pair.second;
percentage.setText(percent + "%");
@@ -164,4 +223,26 @@ public class TrafficProgressPanel extends JPanel {
}
statistics.setText(text);
}
private void setPassesEnabled(final boolean enabled, final Boolean completed) {
new AwtVisitor(passStatuses) {
@Override
public boolean visit(Component component) {
if (component instanceof JProgressBar) {
JProgressBar progress = (JProgressBar)component;
progress.setEnabled(enabled);
if (completed != null) {
if (completed) {
progress.setValue(MAX);
myProgressToText.get(progress).setText(MAX_TEXT);
} else {
progress.setValue(0);
myProgressToText.get(progress).setText(MIN_TEXT);
}
}
}
return false;
}
};
}
}
@@ -24,18 +24,20 @@ import com.intellij.openapi.editor.impl.EditorMarkupModelImpl;
import com.intellij.openapi.editor.impl.TrafficTooltipRenderer;
import com.intellij.ui.HintHint;
import com.intellij.ui.LightweightHint;
import com.intellij.util.ui.update.ComparableObject;
import java.awt.*;
/**
* User: cdr
*/
public class TrafficTooltipRendererImpl implements TrafficTooltipRenderer {
public class TrafficTooltipRendererImpl extends ComparableObject.Impl implements TrafficTooltipRenderer {
private TrafficProgressPanel myPanel;
private final Runnable onHide;
private TrafficLightRenderer myTrafficLightRenderer;
public TrafficTooltipRendererImpl(Runnable onHide) {
public TrafficTooltipRendererImpl(Runnable onHide, Editor editor) {
super(editor);
this.onHide = onHide;
}
@@ -69,9 +71,4 @@ public class TrafficTooltipRendererImpl implements TrafficTooltipRenderer {
repaintTooltipWindow();
return hint;
}
@Override
public boolean equals(Object obj) {
return obj.getClass() == getClass() && myTrafficLightRenderer == ((TrafficTooltipRendererImpl)obj).myTrafficLightRenderer;
}
}
@@ -18,6 +18,7 @@ package com.intellij.execution.actions;
import com.intellij.execution.*;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.configurations.UnknownConfigurationType;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.execution.impl.EditConfigurationsDialog;
import com.intellij.execution.impl.RunDialog;
@@ -452,14 +453,16 @@ public class ChooseRunConfigurationAction extends AnAction {
final Map<RunnerAndConfigurationSettings, ItemWrapper> wrappedExisting = new LinkedHashMap<RunnerAndConfigurationSettings, ItemWrapper>();
final ConfigurationType[] factories = manager.getConfigurationFactories();
for (final ConfigurationType factory : factories) {
final RunnerAndConfigurationSettings[] configurations = manager.getConfigurationSettings(factory);
for (final RunnerAndConfigurationSettings configuration : configurations) {
final ItemWrapper wrapped = ItemWrapper.wrap(project, configuration);
if (configuration == selectedConfiguration) {
wrapped.setMnemonic(1);
}
if (!(factory instanceof UnknownConfigurationType)) {
final RunnerAndConfigurationSettings[] configurations = manager.getConfigurationSettings(factory);
for (final RunnerAndConfigurationSettings configuration : configurations) {
final ItemWrapper wrapped = ItemWrapper.wrap(project, configuration);
if (configuration == selectedConfiguration) {
wrapped.setMnemonic(1);
}
wrappedExisting.put(configuration, wrapped);
wrappedExisting.put(configuration, wrapped);
}
}
}
@@ -24,7 +24,6 @@ import com.intellij.ide.PsiCopyPasteManager;
import com.intellij.ide.SelectInTarget;
import com.intellij.ide.dnd.*;
import com.intellij.ide.dnd.aware.DnDAwareTree;
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel;
import com.intellij.ide.projectView.BaseProjectTreeBuilder;
import com.intellij.ide.projectView.ProjectView;
import com.intellij.ide.projectView.impl.nodes.AbstractModuleNode;
@@ -63,12 +62,10 @@ import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.*;
import java.awt.dnd.DnDConstants;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -581,7 +578,25 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl
@Override
public Pair<Image, Point> createDraggedImage(DnDAction action, Point dragOrigin) {
return null;
final TreePath[] paths = getSelectionPaths();
if (paths == null) return null;
final int count = paths.length;
final JLabel label = new JLabel(String.format("%s item%s", count, count == 1 ? "" : "s"));
label.setOpaque(true);
label.setForeground(myTree.getForeground());
label.setBackground(myTree.getBackground());
label.setFont(myTree.getFont());
label.setSize(label.getPreferredSize());
final BufferedImage image = new BufferedImage(label.getWidth(), label.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D)image.getGraphics();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
label.paint(g2);
g2.dispose();
return new Pair<Image, Point>(image, new Point(-image.getWidth(null), -image.getHeight(null)));
}
@Override
@@ -8,7 +8,7 @@
<properties/>
<border type="none" title=""/>
<children>
<component id="e9af6" class="javax.swing.JLabel">
<component id="e9af6" class="javax.swing.JLabel" binding="myTitleLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -16,7 +16,7 @@
<text resource-bundle="messages/IdeBundle" key="encodings.dialog.caption"/>
</properties>
</component>
<scrollpane class="com.intellij.ui.components.JBScrollPane" id="fe0c3" binding="myTreePanel" custom-create="true">
<scrollpane id="fe0c3" class="com.intellij.ui.components.JBScrollPane" binding="myTreePanel" custom-create="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
@@ -21,7 +21,11 @@ import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.options.*;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.NonDefaultProjectConfigurable;
import com.intellij.openapi.options.OptionalConfigurable;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.IconLoader;
@@ -51,10 +55,12 @@ public class FileEncodingConfigurable implements SearchableConfigurable, NonDefa
private JPanel myPropertiesFilesEncodingCombo;
private Charset mySelectedCharsetForPropertiesFiles;
private JComboBox myIdeEncodingsCombo;
private JLabel myTitleLabel;
private ChooseFileEncodingAction myAction;
public FileEncodingConfigurable(Project project) {
myProject = project;
myTitleLabel.setText(myTitleLabel.getText().replace("$productName", ApplicationNamesInfo.getInstance().getFullProductName()));
}
@Nls
@@ -180,4 +180,6 @@ public interface JBPopup extends Disposable, LightweightWindow {
void setFinalRunnable(@Nullable Runnable runnable);
void moveToFitScreen();
Point getLocationOnScreen();
}
@@ -210,51 +210,25 @@ public class HintManagerImpl extends HintManager implements Disposable {
((ScrollAwareHint)hint.getComponent()).editorScrolled();
}
if (!hint.isVisible()) {
return;
}
if (!hint.isVisible()) return;
Editor editor = e.getEditor();
if (!editor.getComponent().isShowing() || editor.isOneLineMode()) return;
Rectangle newRectangle = e.getOldRectangle();
Rectangle oldRectangle = e.getNewRectangle();
Rectangle bounds = hint.getBounds();
Point location;
final Window window = SwingUtilities.getWindowAncestor(hint.getComponent());
final boolean realPopup = window != null && window != SwingUtilities.getWindowAncestor(editor.getComponent());
if (realPopup) {
location = window.getLocationOnScreen();
SwingUtilities.convertPointFromScreen(location, editor.getContentComponent());
} else {
location = SwingUtilities.convertPoint(
editor.getComponent().getRootPane().getLayeredPane(),
bounds.getLocation(),
editor.getContentComponent()
);
}
Point location = hint.getLocationOn(editor.getContentComponent());
Dimension size = hint.getSize();
int xOffset = location.x - oldRectangle.x;
int yOffset = location.y - oldRectangle.y;
location = new Point(newRectangle.x + xOffset, newRectangle.y + yOffset);
Rectangle newBounds = new Rectangle(location.x, location.y, bounds.width, bounds.height);
final boolean valid = hideIfOutOfEditor ? oldRectangle.contains(newBounds) : oldRectangle.intersects(newBounds);
if (valid) {
if (!realPopup) {
location = SwingUtilities.convertPoint(
editor.getContentComponent(),
location,
editor.getComponent().getRootPane().getLayeredPane()
);
hint.updateBounds(location.x, location.y);
} else {
SwingUtilities.convertPointToScreen(location, editor.getContentComponent());
window.setLocation(location);
}
Rectangle newBounds = new Rectangle(location.x, location.y, size.width, size.height);
final boolean okToUpdateBounds = hideIfOutOfEditor ? oldRectangle.contains(newBounds) : oldRectangle.intersects(newBounds);
if (okToUpdateBounds) {
hint.setLocation(new RelativePoint(editor.getContentComponent(), location));
}
else {
hint.hide();
@@ -26,7 +26,6 @@ import com.intellij.ui.LightweightHint;
import com.intellij.ui.awt.RelativePoint;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
@@ -57,7 +56,13 @@ public class TooltipController {
final boolean alignToRight,
@NotNull final TooltipGroup group, final HintHint hintHint) {
if (myCurrentTooltip == null || !myCurrentTooltip.isVisible()) {
myCurrentTooltipObject = null;
if (myCurrentTooltip != null) {
if (!IdeTooltipManager.getInstance().isQueuedToShow(myCurrentTooltip.getCurrentIdeTooltip())) {
myCurrentTooltipObject = null;
}
} else {
myCurrentTooltipObject = null;
}
}
if (Comparing.equal(tooltipObject, myCurrentTooltipObject)) {
@@ -17,11 +17,12 @@ package com.intellij.ide;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.update.ComparableObject;
import javax.swing.*;
import java.awt.*;
public class IdeTooltip {
public class IdeTooltip extends ComparableObject.Impl {
private Component myComponent;
private Point myPoint;
@@ -34,7 +35,8 @@ public class IdeTooltip {
private boolean myToCenterIfSmall = true;
private boolean myHighlighter;
public IdeTooltip(Component component, Point point, JComponent tipComponent) {
public IdeTooltip(Component component, Point point, JComponent tipComponent, Object... identity) {
super(identity);
myComponent = component;
myPoint = point;
myTipComponent = tipComponent;
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.ui.popup.BalloonBuilder;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
@@ -31,7 +32,9 @@ import com.intellij.ui.HintHint;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.Alarm;
import com.intellij.util.IJSwingUtilities;
import com.intellij.util.containers.ComparatorUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.ComparableObjectCheck;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -72,7 +75,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
private IdeTooltip myCurrentTooltip;
private Runnable myShowRequest;
private IdeTooltip myQueuedTooltip;
public IdeTooltipManager(JBPopupFactory popupFactory) {
@@ -151,7 +154,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
}
private void queueShow(final JComponent c, final MouseEvent me, final boolean toCenter) {
final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null) {
final IdeTooltip tooltip = new IdeTooltip(c, me.getPoint(), null, new Object()) {
@Override
protected boolean beforeShow() {
myCurrentEvent = me;
@@ -179,6 +182,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
hideCurrent(null);
myQueuedComponent = tooltip.getComponent();
myQueuedTooltip = tooltip;
myShowRequest = new Runnable() {
@Override
@@ -265,6 +269,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
myCurrentTooltip = tooltip;
myShowRequest = null;
myQueuedComponent = null;
myQueuedTooltip = null;
myCurrentTipUi.show(new RelativePoint(tooltip.getComponent(), effectivePoint), tooltip.getPreferredPosition());
myAlarm.addRequest(new Runnable() {
@@ -328,6 +333,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
private boolean hideCurrent(@Nullable MouseEvent me) {
myShowRequest = null;
myQueuedComponent = null;
myQueuedTooltip = null;
if (myCurrentTooltip == null) return true;
@@ -378,6 +384,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
myCurrentTipUi = null;
myCurrentComponent = null;
myQueuedComponent = null;
myQueuedTooltip = null;
myCurrentEvent = null;
myCurrentTipIsCentered = false;
myX = -1;
@@ -538,4 +545,8 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
public String getComponentName() {
return "IDE Tooltip Manager";
}
public boolean isQueuedToShow(IdeTooltip tooltip) {
return Comparing.equal(myQueuedTooltip, tooltip);
}
}
@@ -61,7 +61,8 @@ public class TipUIUtil {
StringBuffer text = new StringBuffer(ResourceUtil.loadText(url));
updateShortcuts(text);
browser.read(new StringReader(text.toString()), null);
String replaced = text.toString().replace("&productName;", ApplicationNamesInfo.getInstance().getFullProductName());
browser.read(new StringReader(replaced), null);
final Document document = browser.getDocument();
if (document instanceof HTMLDocument) {
((HTMLDocument)document).setBase(url);
@@ -20,6 +20,7 @@
package com.intellij.openapi.editor.ex;
import com.intellij.codeInsight.hint.TooltipRenderer;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.impl.TrafficTooltipRenderer;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import org.jetbrains.annotations.NotNull;
@@ -33,5 +34,5 @@ public interface ErrorStripTooltipRendererProvider {
TooltipRenderer calcTooltipRenderer(@NotNull String text);
TooltipRenderer calcTooltipRenderer(@NotNull String text, int width);
TrafficTooltipRenderer createTrafficTooltipRenderer(Runnable onHide);
TrafficTooltipRenderer createTrafficTooltipRenderer(Runnable onHide, Editor editor);
}
@@ -77,6 +77,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
private final PropertyChangeSupport myPropertyChangeSupport = new PropertyChangeSupport(this);
private volatile MarkupModelEx myMarkupModel;
private DocumentListener[] myCachedDocumentListeners;
private final List<EditReadOnlyListener> myReadOnlyListeners = new ArrayList<EditReadOnlyListener>(1);
private int myCheckGuardedBlocks = 0;
@@ -468,12 +469,11 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
return null; // suppress events in shutdown hook
}
DocumentEvent event = new DocumentEventImpl(this, offset, oldString, newString, myModificationStamp, wholeTextReplaced);
//System.out.printf("%nbefore change: offset=%d, old text='%s', new text='%s', document modification stamp=%d%nDocument:'%s'%n",
// event.getOffset(), event.getOldFragment(), event.getNewFragment(), event.getDocument().getModificationStamp(),
// event.getDocument().getText());
for (int i = myDocumentListeners.size() - 1; i >= 0; i--) {
DocumentListener[] listeners = getCachedListeners();
for (int i = listeners.length - 1; i >= 0; i--) {
try {
myDocumentListeners.get(i).beforeDocumentChange(event);
listeners[i].beforeDocumentChange(event);
}
catch (Throwable e) {
LOG.error(e);
@@ -484,10 +484,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
return event;
}
@SuppressWarnings({"ForLoopReplaceableByForEach"})
private void changedUpdate(DocumentEvent event, long newModificationStamp) {
//System.out.printf("after change: new modification stamp=%d%ndocument='%s'%n", event.getDocument().getModificationStamp(),
// event.getDocument().getText());
if (ShutDownTracker.isShutdownHookRunning()) {
return; // suppress events in shutdown hook
}
@@ -497,10 +494,10 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
myLineSet.changedUpdate(event);
setModificationStamp(newModificationStamp);
// Don't use for-each in order to avoid unnecessary iterator construction during frequent document updates.
for (int i = 0; i < myDocumentListeners.size(); i++) {
DocumentListener[] listeners = getCachedListeners();
for (DocumentListener listener : listeners) {
try {
myDocumentListeners.get(i).documentChanged(event);
listener.documentChanged(event);
}
catch (Throwable e) {
LOG.error(e);
@@ -557,21 +554,9 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
public void addDocumentListener(@NotNull DocumentListener listener) {
myCachedDocumentListeners = null;
LOG.assertTrue(!myDocumentListeners.contains(listener), listener);
if (!(listener instanceof PrioritizedDocumentListener)) {
myDocumentListeners.add(listener);
return;
}
int i = Collections.binarySearch(myDocumentListeners, listener, PrioritizedDocumentListener.COMPARATOR);
if (i < 0) {
i = -i - 1;
}
if (i >= myDocumentListeners.size()) {
myDocumentListeners.add(listener);
}
else {
myDocumentListeners.add(i, listener);
}
myDocumentListeners.add(listener);
}
public void addDocumentListener(@NotNull final DocumentListener listener, @NotNull Disposable parentDisposable) {
@@ -584,6 +569,7 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
}
public void removeDocumentListener(@NotNull DocumentListener listener) {
myCachedDocumentListeners = null;
boolean success = myDocumentListeners.remove(listener);
LOG.assertTrue(success);
}
@@ -631,6 +617,15 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
return lineCount;
}
private DocumentListener[] getCachedListeners() {
if (myCachedDocumentListeners == null) {
Collections.sort(myDocumentListeners, PrioritizedDocumentListener.COMPARATOR);
myCachedDocumentListeners = myDocumentListeners.toArray(new DocumentListener[myDocumentListeners.size()]);
}
return myCachedDocumentListeners;
}
public void fireReadOnlyModificationAttempt() {
ApplicationManagerEx.getApplicationEx().assertReadAccessToDocumentsAllowed();
EditReadOnlyListener[] listeners = myReadOnlyListeners.toArray(
@@ -608,17 +608,15 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
private TrafficTooltipRenderer myTrafficTooltipRenderer;
private void showTrafficLightTooltip(MouseEvent e) {
//final String tooltipMessage = myErrorStripeRenderer.getTooltipMessage();
//if (tooltipMessage == null) return;
if (myTrafficTooltipRenderer == null) {
myTrafficTooltipRenderer = myTooltipRendererProvider.createTrafficTooltipRenderer(new Runnable() {
@Override
public void run() {
myTrafficTooltipRenderer = null;
}
});
}, myEditor);
}
showTooltip(e, myTrafficTooltipRenderer, new HintHint(e).setAwtTooltip(true).setPreferredPosition(Balloon.Position.atLeft));
showTooltip(e, myTrafficTooltipRenderer, new HintHint(e).setAwtTooltip(true).setMayCenterPosition(true).setContentActive(false).setPreferredPosition(Balloon.Position.atLeft));
}
private void repaintTrafficTooltip() {
@@ -655,6 +653,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
scrollbar.addMouseListener(handler);
myErrorStripeButton.addMouseListener(myHandler);
}
}
private void showTooltip(MouseEvent e, final TooltipRenderer tooltipObject, HintHint hintHint) {
@@ -737,7 +736,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
}
@Override
public TrafficTooltipRenderer createTrafficTooltipRenderer(final Runnable onHide) {
public TrafficTooltipRenderer createTrafficTooltipRenderer(final Runnable onHide, Editor editor) {
return new TrafficTooltipRenderer() {
@Override
public void repaintTooltipWindow() {
@@ -28,7 +28,9 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.IntArrayList;
import com.intellij.util.io.*;
import com.intellij.util.io.PagedFileStorage;
import com.intellij.util.io.PersistentStringEnumerator;
import com.intellij.util.io.ResizeableMappedFile;
import com.intellij.util.io.storage.AbstractStorage;
import com.intellij.util.io.storage.HeavyProcessLatch;
import com.intellij.util.io.storage.RefCountingStorage;
@@ -69,8 +71,6 @@ public class FSRecords implements Disposable, Forceable {
private static final int RECORD_SIZE = LENGTH_OFFSET + LENGTH_SIZE;
private final byte[] myRecordBuffer = new byte[RECORD_SIZE];
private static final byte[] ZEROES = new byte[RECORD_SIZE];
private static final int HEADER_VERSION_OFFSET = 0;
@@ -98,20 +98,20 @@ public class FSRecords implements Disposable, Forceable {
}
private static class DbConnection {
private static int refCount = 0;
private static final Object LOCK = new Object();
private static final TObjectIntHashMap<String> myAttributeIds = new TObjectIntHashMap<String>();
private static PersistentStringEnumerator myNames;
private static PersistentStringEnumerator myNames;
private static Storage myAttributes;
private static RefCountingStorage myContents;
private static ResizeableMappedFile myRecords;
private static final TIntArrayList myFreeRecords = new TIntArrayList();
private static boolean myDirty = false;
private static boolean myDirty = false;
private static ScheduledFuture<?> myFlushingFuture;
private static boolean myCorrupted = false;
public static DbConnection connect() {
synchronized (LOCK) {
if (refCount == 0) {
@@ -334,6 +334,7 @@ public class FSRecords implements Disposable, Forceable {
return myDirty || myNames.isDirty() || myAttributes.isDirty() || myContents.isDirty() || myRecords.isDirty();
}
private static int getVersion() throws IOException {
final int recordsVersion = myRecords.getInt(HEADER_VERSION_OFFSET);
if (myAttributes.getVersion() != recordsVersion || myContents.getVersion() != recordsVersion) return -1;
@@ -341,7 +342,6 @@ public class FSRecords implements Disposable, Forceable {
return recordsVersion;
}
public static long getTimestamp() {
return myRecords.getLong(HEADER_TIMESTAMP_OFFSET);
}
@@ -434,8 +434,8 @@ public class FSRecords implements Disposable, Forceable {
public static void addFreeRecord(final int id) {
myFreeRecords.add(id);
}
}
public FSRecords() {
}
@@ -465,7 +465,7 @@ public class FSRecords implements Disposable, Forceable {
return DbConnection.getNames();
}
public static int createRecord(boolean clean) {
public static int createRecord() {
synchronized (lock) {
try {
DbConnection.markDirty();
@@ -475,16 +475,12 @@ public class FSRecords implements Disposable, Forceable {
final int filelength = (int)getRecords().length();
LOG.assertTrue(filelength % RECORD_SIZE == 0);
int newrecord = filelength / RECORD_SIZE;
if (clean) {
DbConnection.cleanRecord(newrecord);
assert filelength + RECORD_SIZE == getRecords().length();
}
DbConnection.cleanRecord(newrecord);
assert filelength + RECORD_SIZE == getRecords().length();
return newrecord;
}
else {
if (clean) {
DbConnection.cleanRecord(free);
}
DbConnection.cleanRecord(free);
return free;
}
}
@@ -618,7 +614,7 @@ public class FSRecords implements Disposable, Forceable {
final DataOutputStream output = writeAttribute(1, CHILDREN_ATT);
int id;
try {
id = createRecord(true);
id = createRecord();
output.writeInt(names.length + 1);
for (int i = 0; i < names.length; i++) {
output.writeInt(names[i]);
@@ -787,30 +783,6 @@ public class FSRecords implements Disposable, Forceable {
}
}
public void saveRecord(int id, int parent, String name, long timeStamp, int flags, long length) {
if (id == parent) {
LOG.error("Cyclic parent/child relations");
return;
}
synchronized (lock) {
try {
DbConnection.markDirty();
incModCount(id);
Bits.putInt(myRecordBuffer, PARENT_OFFSET, parent);
Bits.putInt(myRecordBuffer, NAME_OFFSET, getNames().enumerate(name));
Bits.putInt(myRecordBuffer, FLAGS_OFFSET, flags);
Bits.putLong(myRecordBuffer, TIMESTAMP_OFFSET, timeStamp);
Bits.putLong(myRecordBuffer, LENGTH_OFFSET, length);
getRecords().put(getOffset(id, PARENT_OFFSET), myRecordBuffer, 0, RECORD_SIZE);
}
catch (Throwable e) {
throw DbConnection.handleError(e);
}
}
}
public static String getName(int id) {
synchronized (lock) {
try {
@@ -170,7 +170,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
childrenIds[i] = currentIds[idx];
}
else {
int childId = FSRecords.createRecord(false);
int childId = FSRecords.createRecord();
copyRecordFromDelegateFS(childId, id, new FakeVirtualFile(file, name), delegate);
childrenIds[i] = childId;
}
@@ -247,15 +247,21 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
}
String name = file.getName();
if (name.length() > 0 && namesEqual(delegate, name, FSRecords.getName(id))) return; // TODO: Handle root attributes change.
if (name.length() == 0) { // TODO: hack
if (areChildrenLoaded(id)) return;
}
boolean isDirectory = delegate.isDirectory(file);
int flags = (isDirectory ? IS_DIRECTORY_FLAG : 0) | (delegate.isWritable(file) ? 0 : IS_READ_ONLY);
myRecords.setParent(id, parentId);
myRecords.setName(id, name);
myRecords.setTimestamp(id, delegate.getTimeStamp(file));
myRecords.setFlags(id, (delegate.isDirectory(file) ? IS_DIRECTORY_FLAG : 0) | (delegate.isWritable(file) ? 0 : IS_READ_ONLY), true);
myRecords.setLength(id, -1L);
myRecords.saveRecord(id, parentId, name, delegate.getTimeStamp(file), flags, isDirectory ? -1L : delegate.getLength(file));
//
// TODO!!!: More attributes?
}
@@ -324,7 +330,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
VirtualFile fake = new FakeVirtualFile(parent, childName);
if (delegate.exists(fake)) {
int child = FSRecords.createRecord(false);
int child = FSRecords.createRecord();
copyRecordFromDelegateFS(child, parentId, fake, delegate);
myRecords.updateList(parentId, ArrayUtil.append(children, child));
return child;
@@ -639,11 +645,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
}
if (!fs.exists(root)) return null;
String name = root.getName();
if (name.length() == 0 || !namesEqual(fs, name, FSRecords.getName(rootId))) {
copyRecordFromDelegateFS(rootId, 0, root, fs);
}
copyRecordFromDelegateFS(rootId, 0, root, fs);
}
catch (IOException e) {
throw new RuntimeException(e);
@@ -808,7 +810,7 @@ public class PersistentFS extends ManagingFS implements ApplicationComponent {
VirtualFile fakeFile = new FakeVirtualFile(parent, name);
if (delegate.exists(fakeFile)) {
final int parentId = getFileId(parent);
int childId = FSRecords.createRecord(false);
int childId = FSRecords.createRecord();
copyRecordFromDelegateFS(childId, parentId, fakeFile, delegate);
appendIdToParentList(parentId, childId);
@@ -37,6 +37,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.GeneralPath;
@@ -17,6 +17,7 @@ package com.intellij.ui;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.ui.awt.RelativePoint;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -94,7 +95,7 @@ public class HeavyweightHint implements Hint {
}
@Override
public void updateBounds() {
public void pack() {
updateBounds(-1, -1, false);
}
@@ -113,6 +114,13 @@ public class HeavyweightHint implements Hint {
}
}
@Override
public void setLocation(RelativePoint point) {
if (myWindow != null) {
myWindow.setLocation(point.getScreenPoint().x, point.getScreenPoint().y);
}
}
public void addHintListener(HintListener listener) {
myListenerList.add(HintListener.class, listener);
}
@@ -15,6 +15,7 @@
*/
package com.intellij.ui;
import com.intellij.ui.awt.RelativePoint;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -41,7 +42,16 @@ public interface Hint {
void removeHintListener(HintListener listener);
void updateBounds();
void pack();
void setLocation(RelativePoint point);
/**
* Pack and set location
* @param x
* @param y
* @deprecated use {@link Hint#setLocation(com.intellij.ui.awt.RelativePoint)} ()}
*/
void updateBounds(int x, int y);
}
@@ -36,6 +36,7 @@ public class HintHint {
private boolean myContentActive = true;
private boolean myQuickHint = false;
private boolean myMayCenterTooltip = false;
public HintHint(MouseEvent e) {
this(e.getComponent(), e.getPoint());
@@ -55,6 +56,15 @@ public class HintHint {
return this;
}
public HintHint setMayCenterPosition(boolean mayCenter) {
myMayCenterTooltip = mayCenter;
return this;
}
public boolean isMayCenterTooltip() {
return myMayCenterTooltip;
}
public HintHint setPreferredPosition(Balloon.Position position) {
myPreferredPosition = position;
return this;
@@ -58,6 +58,7 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
private boolean myResizable;
private IdeTooltip myCurrentIdeTooltip;
private HintHint myHintHint;
public LightweightHint(@NotNull final JComponent component) {
myComponent = component;
@@ -107,6 +108,7 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
final JComponent focusBackComponent,
@NotNull final HintHint hintHint) {
myParentComponent = parentComponent;
myHintHint = hintHint;
myFocusBackComponent = focusBackComponent;
@@ -125,7 +127,7 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
if (hintHint.isAwtTooltip()) {
IdeTooltip tooltip = new IdeTooltip(hintHint.getOriginalComponent(), hintHint.getOriginalPoint(), myComponent) {
IdeTooltip tooltip = new IdeTooltip(hintHint.getOriginalComponent(), hintHint.getOriginalPoint(), myComponent, hintHint, myComponent) {
@Override
protected boolean canAutohideOn(TooltipEvent event) {
if (event.getInputEvent() instanceof MouseEvent) {
@@ -145,7 +147,7 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
public boolean canBeDismissedOnTimeout() {
return false;
}
}.setToCenterIfSmall(false).setPreferredPosition(hintHint.getPreferredPosition()).setHighlighterType(hintHint.isHightlighterType());
}.setToCenterIfSmall(hintHint.isMayCenterTooltip()).setPreferredPosition(hintHint.getPreferredPosition()).setHighlighterType(hintHint.isHightlighterType());
myComponent.validate();
myCurrentIdeTooltip = IdeTooltipManager.getInstance().show(tooltip, false);
@@ -205,10 +207,10 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
}
public boolean isVisible() {
return myIsRealPopup ? myPopup != null : myComponent.isShowing();
return myIsRealPopup ? (myPopup != null && myPopup.isVisible()) : myComponent.isShowing();
}
protected final boolean isRealPopup() {
public final boolean isRealPopup() {
return myIsRealPopup;
}
@@ -254,7 +256,7 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
}
@Override
public void updateBounds() {
public void pack() {
updateBounds(-1, -1, false);
}
@@ -264,22 +266,9 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
}
private void updateBounds(int x, int y, boolean updateLocation) {
if (myIsRealPopup) {
if (myPopup == null) return;
if (updateLocation) ((AbstractPopup)myPopup).setLocation(new RelativePoint(myParentComponent, new Point(x, y)));
myPopup.setSize(myComponent.getPreferredSize());
}
else {
if (updateLocation) {
JLayeredPane layeredPane = myParentComponent.getRootPane().getLayeredPane();
myComponent.setLocation(SwingUtilities.convertPoint(myParentComponent, x, y, layeredPane));
}
Dimension preferredSize = myComponent.getPreferredSize();
myComponent.setSize(preferredSize.width, preferredSize.height);
myComponent.validate();
myComponent.repaint();
setSize(myComponent.getPreferredSize());
if (updateLocation) {
setLocation(new RelativePoint(myParentComponent, new Point(x, y)));
}
}
@@ -295,6 +284,60 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
myListenerList.remove(HintListener.class, listener);
}
public Point getLocationOn(JComponent c) {
Point location;
if (isRealPopup()) {
location = myPopup.getLocationOnScreen();
SwingUtilities.convertPointFromScreen(location, c);
} else {
location = SwingUtilities.convertPoint(
myComponent.getParent(),
myComponent.getLocation(),
c
);
}
return location;
}
@Override
public void setLocation(RelativePoint point) {
if (isRealPopup()) {
myPopup.setLocation(point.getScreenPoint());
} else {
if (myHintHint.isAwtTooltip()) {
//todo kirillk
throw new UnsupportedOperationException();
} else {
Point targetPoint = point.getPoint(myComponent.getParent());
myComponent.setLocation(targetPoint);
myComponent.revalidate();
myComponent.repaint();
}
}
}
public void setSize(Dimension size) {
if (myIsRealPopup) {
myPopup.setSize(size);
} else {
//todo kirillk
if (myHintHint.isAwtTooltip()) {
throw new UnsupportedOperationException();
} else {
myComponent.setSize(size);
myComponent.revalidate();
myComponent.repaint();
}
}
}
public Dimension getSize() {
return myComponent.getSize();
}
private final class MyEscListener implements ActionListener {
public final void actionPerformed(final ActionEvent e) {
hide();
@@ -309,4 +352,8 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
public boolean canControlAutoHide() {
return myCurrentIdeTooltip != null && myCurrentIdeTooltip.getTipComponent().isShowing() ;
}
public IdeTooltip getCurrentIdeTooltip() {
return myCurrentIdeTooltip;
}
}
@@ -1136,6 +1136,18 @@ public class AbstractPopup implements JBPopup {
return wnd;
}
@Override
public Point getLocationOnScreen() {
Dimension headerCorrectionSize = myLocateByContent ? myHeaderPanel.getPreferredSize() : null;
Point screenPoint = myContent.getLocationOnScreen();
if (headerCorrectionSize != null) {
screenPoint.y -= headerCorrectionSize.height;
}
return screenPoint;
}
public void setSize(@NotNull final Dimension size) {
if (myPopup == null) {
myForcedSize = size;
@@ -9,27 +9,27 @@ method.implements.in=Implements method ''{0}'' in ''{1}''
method.overrides=Overrides method in ''{1}''
method.overrides.in=Overrides method ''{0}'' in ''{1}''
analysis.hasnot.been.run=No analysis has been performed.
analysis.hasnot.been.run=No analysis has been performed
no.syntax.highlighting.performed=No syntax highlighting performed.
no.inspections.performed=No inspections performed.
no.syntax.highlighting.performed=No syntax highlighting performed
no.inspections.performed=No inspections performed
# These two aren't unused!
# suppress inspection "UnusedProperty"
no.syntax.highlighting.performed.for=No syntax highlighting performed for {0}.
no.syntax.highlighting.performed.for=No syntax highlighting performed for {0}
# suppress inspection "UnusedProperty"
no.inspections.performed.for=No inspections performed {0}.
no.inspections.performed.for=No inspections performed {0}
pass.syntax=Syntax analysis
pass.inspection=Inspections
pass.wolf=Checking red files
pass.whole.inspections=Slow Inspections
analysis.completed=Analysis completed.
analysis.completed=Analysis completed
no.errors.or.warnings.found=No errors or warnings found.
no.errors.or.warnings.found.so.far=No errors or warnings found so far.
errors.found.so.far=<b>{0}</b> {1} found so far.
errors.found=<b>{0}</b> {1} found.
no.errors.or.warnings.found=No errors or warnings found
no.errors.or.warnings.found.so.far=No errors or warnings found so far
errors.found.so.far=<b>{0}</b> {1} found so far
errors.found=<b>{0}</b> {1} found
error.highlighting.settings=Error highlighting settings
method.is.implemented.header=Is implemented in <br>
@@ -1042,7 +1042,7 @@ finished.with.exit.code.text.message=Process finished with exit code {0}
# Encodings
file.encodings.configurable=File Encodings
encodings.dialog.caption=<html><body>\
To change encoding IntelliJ IDEA uses for a file, directory, or an entire project,<br>\
To change encoding $productName uses for a file, directory, or an entire project,<br>\
click an item and then select encoding from the Default Encoding list.<br>\
Notes:<br>\
Built-in file encoding (e.g. JSP, HTML or XML) overrides encoding you specify here.<br>\
@@ -99,4 +99,4 @@ jar.build=false
keymap.show.alias.actions=false
frameworks.download.libraries.server.url=http://pluginsrepo-test:8080
caches.indexerThreadsCount=-1
caches.indexerThreadsCount=1
@@ -2,8 +2,8 @@
<body style="font-family: Verdana; font-size: 13;" LEFTMARGIN="25" TOPMARGIN="25">
<table cellpadding="15" width="98%" border="0">
<tr>
<td><p><font style="font-family: Verdana; font-weight:bold;" size="3" color="#003399">IntelliJ</font>
<font style="font-family: Verdana; font-weight:bold;" size="3" color="#3366cc">IDEA</font> simplifies working
<td><p><font style="font-family: Verdana; font-weight:bold;" size="3" color="#003399">&productName;</font>
simplifies working
with colors in CSS files. The <font style="font-family: Courier; " size="3" color="#003399">color</font>
properties are marked with the icons of the corresponding color in the left gutter area of the editor.
Use these icons to view colors and change color values. When you point with your mouse cursor to the color icon,
@@ -0,0 +1,10 @@
<html>
<body style="font-family: Verdana; font-size: 13;" LEFTMARGIN="25" TOPMARGIN="25"><table cellpadding="15" width="98%" border="0"><tr><td>
You can easily open an external file for editing, if you just drag it from the Explorer/Finder to the editor.
<p><img hspace="20" src="images/dragToOpen.png"></p>
</td></tr></table></body>
</html>
@@ -0,0 +1,14 @@
<html>
<body style="font-family: Verdana; font-size: 13;" LEFTMARGIN="25" TOPMARGIN="25">
<table cellpadding="15" width="98%" border="0">
You can jump directly to any deeply buried file, if you press &shortcut:GotoFile;, and type just a couple
of characters of the enclosing directories and file names:
<p><img hspace="20" src="images/enterDirectory.png"></p>
Use either slash or backslash as the delimiters.
</table>
</body>
</html>
@@ -3,7 +3,7 @@
<table cellpadding="15" width="98%" border="0">
<tr>
<td>
Did you know that <b>IntelliJ IDEA</b> lets you jump from your checkin comment to an issue in tracker? <br/>
Did you know that <b>&productName;</b> lets you jump from your checkin comment to an issue in tracker? <br/>
All you have to do is to define issue navigation patterns in the
<font style="font-family: Verdana; font-weight:bold;" size="3" color="#005555">Settings | Version Control</font>
dialog: <br/>
@@ -2,10 +2,10 @@
<body style="font-family: Verdana; font-size: 13;" LEFTMARGIN="25" TOPMARGIN="25">
<table cellpadding="15" width="98%" border="0">
<tr>
<td>Did you know that you can close tabs in the editor and the tool windows of IntelliJ IDEA without actually
<td>Did you know that you can close tabs in the editor and the tool windows of &productName; without actually
using the context menu commands?
It is enough to point with your mouse cursor to a tab to be closed, and click the middle mouse button, or just
use the shift+click combination. </td>
use the Shift+click combination. </td>
</tr>
</table>
</body>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -159,7 +159,7 @@ public class NameUtil {
buffer.append(Character.toLowerCase(c));
}
if (!firstIdentifierLetter) {
buffer.append("|[A-Za-z\\s0-9\\$]*[_-][");
buffer.append("|[A-Za-z\\s0-9\\$]*[_-]+[");
buffer.append(c);
buffer.append(Character.toLowerCase(c));
buffer.append("]");
@@ -172,7 +172,7 @@ public class NameUtil {
buffer.append(Character.toUpperCase(c));
buffer.append(']');
if (lowerCaseWords) {
buffer.append("([a-z\\s0-9\\$]*[-_])?");
buffer.append("([a-z\\s0-9\\$]*[-_]+)?");
}
}
else {
@@ -195,7 +195,7 @@ public class NameUtil {
firstIdentifierLetter = true;
}
else if (c == ' ') {
buffer.append("([a-z\\s0-9\\$_-]*[\\ _-])+");
buffer.append("([a-z\\s0-9\\$_-]*[\\ _-]+)+");
firstIdentifierLetter = true;
}
else {
@@ -174,7 +174,7 @@ public abstract class QuickFixManager <T extends JComponent>{
Rectangle hintRect = new Rectangle(rc.x - myIcon.getIconWidth() - 4, rc.y, myIcon.getIconWidth() + 4, myIcon.getIconHeight() + 4);
LOG.debug("hintRect=" + hintRect);
if (getHintClipRect(viewPort).contains(hintRect)) {
myHint.updateBounds();
myHint.pack();
}
else {
myHint.hide();
+3
View File
@@ -103,4 +103,7 @@
<tip file="Spellchecker.html"/>
<tip file="SpellcheckerDictionaries.html"/>
<tip file="VcsQuickList.html"/>
<tip file="Switcher.html"/>
<tip file="DragToOpen.html"/>
<tip file="EnterDirectoryInGotoFile.html"/>
</tips>