diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
index 2bedea9e7225..3d11db3766b3 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
@@ -31,7 +31,6 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.ex.MarkupModelEx;
import com.intellij.openapi.editor.impl.DocumentMarkupModel;
-import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.fileEditor.FileDocumentManager;
@@ -68,9 +67,6 @@ import javax.swing.*;
* Time: 3:22:55 PM
*/
public abstract class BreakpointWithHighlighter
extends Breakpoint
{
- @Nullable
- private RangeHighlighter myHighlighter;
-
@Nullable
private SourcePosition mySourcePosition;
@@ -127,10 +123,6 @@ public abstract class BreakpointWithHighlighter
getCategory();
- public boolean canMoveTo(@Nullable final SourcePosition position) {
- if (position == null || !position.getFile().isValid()) {
- return false;
- }
- final PsiFile psiFile = position.getFile();
- final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
- if (document == null) {
- return false;
- }
- final int spOffset = position.getOffset();
- if (spOffset < 0) {
- return false;
- }
- final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager();
- return breakpointManager.findBreakpoint(document, spOffset, getCategory()) == null;
- }
+ //public boolean canMoveTo(@Nullable final SourcePosition position) {
+ // if (position == null || !position.getFile().isValid()) {
+ // return false;
+ // }
+ // final PsiFile psiFile = position.getFile();
+ // final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
+ // if (document == null) {
+ // return false;
+ // }
+ // final int spOffset = position.getOffset();
+ // if (spOffset < 0) {
+ // return false;
+ // }
+ // final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager();
+ // return breakpointManager.findBreakpoint(document, spOffset, getCategory()) == null;
+ //}
- public boolean moveTo(@NotNull SourcePosition position) {
- if (!canMoveTo(position)) {
- return false;
- }
- final PsiFile psiFile = position.getFile();
- final PsiFile oldFile = getSourcePosition().getFile();
- final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
- final Document oldDocument = PsiDocumentManager.getInstance(getProject()).getDocument(oldFile);
- if (document == null || oldDocument == null) {
- return false;
- }
- final RangeHighlighter newHighlighter = createHighlighter(myProject, document, position.getLine());
- if (newHighlighter == null) {
- return false;
- }
- final RangeHighlighter oldHighlighter = myHighlighter;
- myHighlighter = newHighlighter;
-
- reload();
-
- if (!isValid()) {
- myHighlighter.dispose();
- myHighlighter = oldHighlighter;
- reload();
- return false;
- }
-
- if (oldHighlighter != null) {
- oldHighlighter.dispose();
- }
-
- DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager().fireBreakpointChanged(this);
- updateUI();
-
- return true;
- }
+ //public boolean moveTo(@NotNull SourcePosition position) {
+ // if (!canMoveTo(position)) {
+ // return false;
+ // }
+ // final PsiFile psiFile = position.getFile();
+ // final PsiFile oldFile = getSourcePosition().getFile();
+ // final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
+ // final Document oldDocument = PsiDocumentManager.getInstance(getProject()).getDocument(oldFile);
+ // if (document == null || oldDocument == null) {
+ // return false;
+ // }
+ // final RangeHighlighter newHighlighter = createHighlighter(myProject, document, position.getLine());
+ // if (newHighlighter == null) {
+ // return false;
+ // }
+ // final RangeHighlighter oldHighlighter = myHighlighter;
+ // myHighlighter = newHighlighter;
+ //
+ // reload();
+ //
+ // if (!isValid()) {
+ // myHighlighter.dispose();
+ // myHighlighter = oldHighlighter;
+ // reload();
+ // return false;
+ // }
+ //
+ // if (oldHighlighter != null) {
+ // oldHighlighter.dispose();
+ // }
+ //
+ // DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager().fireBreakpointChanged(this);
+ // updateUI();
+ //
+ // return true;
+ //}
public boolean isVisible() {
return myVisible;
@@ -535,13 +489,8 @@ public abstract class BreakpointWithHighlighter
breakpoint) {
- final RangeHighlighter highlighter = oldBreakpoint.getHighlighter();
- if (highlighter != null) {
- highlighter.dispose();
- }
}
@Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
index 369ce919f5a1..8eaba9c54615 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
@@ -16,7 +16,6 @@
package com.intellij.psi.impl.compiled;
import com.intellij.diagnostic.PluginException;
-import com.intellij.ide.caches.FileContent;
import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.ide.plugins.PluginManagerCore;
@@ -476,11 +475,6 @@ public class ClsFileImpl extends ClsRepositoryPsiElement
}
}
- @Override
- public PsiFile cacheCopy(final FileContent content) {
- return this;
- }
-
@Override
public void putInfo(@NotNull Map info) {
PsiFileImpl.putInfo(this, info);
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy
index 02d52a54da24..6237f9ca6f30 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -14,11 +14,10 @@
* limitations under the License.
*/
package com.intellij.codeInsight.highlighting
-
import com.intellij.JavaTestUtil
+import com.intellij.codeInsight.daemon.impl.HighlightInfoType
import com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory
import com.intellij.codeInspection.sillyAssignment.SillyAssignmentInspection
-import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.jetbrains.annotations.NonNls
/**
@@ -233,7 +232,7 @@ class Bar {
try {
def infos = myFixture.doHighlighting()
//import highlighted twice: for each overloaded usage target
- assert infos.findAll { it.severity == HighlightSeverity.INFORMATION && myFixture.file.text.substring(it.startOffset, it.endOffset) == 'foo' }.size() == 3
+ assert infos.findAll { it.severity == HighlightInfoType.ELEMENT_UNDER_CARET_SEVERITY && myFixture.file.text.substring(it.startOffset, it.endOffset) == 'foo' }.size() == 3
}
finally {
IdentifierHighlighterPassFactory.ourTestingIdentifierHighlighting = false
diff --git a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
index 1c9ad33a8eea..f320d7efea64 100644
--- a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
+++ b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
@@ -129,7 +129,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
}
public void readExternal(@NotNull Document document, @NotNull URL url) throws InvalidDataException, FileNotFoundException {
- document = JDOMXIncluder.resolve(document, url.toExternalForm());
+ document = JDOMXIncluder.resolve(document, url.toExternalForm(), ApplicationManager.getApplication().isUnitTestMode());
Element rootElement = document.getRootElement();
internJDOMElement(rootElement);
readExternal(document.getRootElement());
diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiFileEx.java b/platform/core-impl/src/com/intellij/psi/impl/PsiFileEx.java
index cf7543aeaac4..c06f656940f6 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/PsiFileEx.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/PsiFileEx.java
@@ -16,7 +16,6 @@
package com.intellij.psi.impl;
-import com.intellij.ide.caches.FileContent;
import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiFile;
@@ -25,5 +24,4 @@ public interface PsiFileEx extends PsiFile{
boolean isContentsLoaded();
void onContentReload();
- PsiFile cacheCopy(final FileContent content); // See CacheUtil
}
diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java
index a25c3d52eddf..2c4c00204937 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java
@@ -16,7 +16,6 @@
package com.intellij.psi.impl;
-import com.intellij.ide.caches.FileContent;
import com.intellij.lang.PsiBuilderFactory;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
@@ -27,11 +26,9 @@ import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.util.Key;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.psi.*;
-import com.intellij.psi.impl.cache.CacheUtil;
import com.intellij.psi.impl.file.impl.FileManager;
import com.intellij.psi.impl.file.impl.FileManagerImpl;
import com.intellij.psi.util.PsiModificationTracker;
@@ -67,7 +64,6 @@ public class PsiManagerImpl extends PsiManagerEx {
private final AtomicInteger myBatchFilesProcessingModeCount = new AtomicInteger(0);
- private static final Key CACHED_PSI_FILE_COPY_IN_FILECONTENT = Key.create("CACHED_PSI_FILE_COPY_IN_FILECONTENT");
public static final Topic ANY_PSI_CHANGE_TOPIC =
Topic.create("ANY_PSI_CHANGE_TOPIC", AnyPsiChangeListener.class, Topic.BroadcastDirection.TO_PARENT);
@@ -200,25 +196,6 @@ public class PsiManagerImpl extends PsiManagerEx {
LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode());
}
- @Nullable
- public PsiFile getFile(@NotNull FileContent content) {
- PsiFile psiFile = content.getUserData(CACHED_PSI_FILE_COPY_IN_FILECONTENT);
- if (psiFile == null) {
- final VirtualFile vFile = content.getVirtualFile();
- psiFile = myFileManager.getCachedPsiFile(vFile);
- if (psiFile == null) {
- psiFile = findFile(vFile);
- if (psiFile == null) return null;
- psiFile = CacheUtil.createFileCopy(content, psiFile);
- }
- //psiFile = content.putUserDataIfAbsent(CACHED_PSI_FILE_COPY_IN_FILECONTENT, psiFile);
- content.putUserData(CACHED_PSI_FILE_COPY_IN_FILECONTENT, psiFile);
- }
-
- LOG.assertTrue(psiFile instanceof PsiCompiledElement || psiFile.isValid());
- return psiFile;
- }
-
@Override
public PsiDirectory findDirectory(@NotNull VirtualFile file) {
ProgressIndicatorProvider.checkCanceled();
diff --git a/platform/core-impl/src/com/intellij/psi/impl/cache/CacheUtil.java b/platform/core-impl/src/com/intellij/psi/impl/cache/CacheUtil.java
index ed7ba4d12823..8e5ed1b22a93 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/cache/CacheUtil.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/cache/CacheUtil.java
@@ -16,61 +16,13 @@
package com.intellij.psi.impl.cache;
-import com.intellij.ide.caches.FileContent;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageParserDefinitions;
import com.intellij.lang.ParserDefinition;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.impl.PsiFileEx;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
public class CacheUtil {
- public static final Key CACHE_COPY_KEY = new Key("CACHE_COPY_KEY");
-
- private CacheUtil() {
- }
-
- public static boolean isCopy(@NotNull PsiFile psiFile) {
- return psiFile.getUserData(CACHE_COPY_KEY) != null;
- }
-
- public static PsiFile createFileCopy(FileContent content, PsiFile psiFile) {
- VirtualFile vFile = psiFile.getVirtualFile();
- if (vFile == null) return psiFile; // It's already a copy created via PsiManager.getFile(FileContent). Usually happens on initial startup.
-
- if (psiFile instanceof PsiFileEx) {
- return ((PsiFileEx)psiFile).cacheCopy(content);
- }
-
- return psiFile;
- }
-
- private static final Key CONTENT_KEY = new Key("CONTENT_KEY");
-
- public static CharSequence getContentText(final FileContent content) {
- final Document doc = FileDocumentManager.getInstance().getCachedDocument(content.getVirtualFile());
- if (doc != null) return doc.getCharsSequence();
-
- CharSequence cached = content.getUserData(CONTENT_KEY);
- if (cached != null) return cached;
- try {
- cached = LoadTextUtil.getTextByBinaryPresentation(content.getBytes(), content.getVirtualFile(), false, false);
- cached = content.putUserDataIfAbsent(CONTENT_KEY, cached);
- return cached;
- }
- catch (IOException e) {
- return "";
- }
- }
public static boolean isInComments(final IElementType tokenType) {
final Language language = tokenType.getLanguage();
diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
index 5d73c0d10e83..5137ace2d63d 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
@@ -17,7 +17,6 @@
package com.intellij.psi.impl.source;
import com.intellij.extapi.psi.StubBasedPsiElementBase;
-import com.intellij.ide.caches.FileContent;
import com.intellij.ide.util.PsiNavigationSupport;
import com.intellij.lang.ASTFactory;
import com.intellij.lang.ASTNode;
@@ -29,7 +28,6 @@ import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.Key;
@@ -374,10 +372,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
treeElement.rawAddChildrenWithoutNotifications(contentLeaf);
}
- if (CacheUtil.isCopy(this)) {
- treeElement.setCharTable(IdentityCharTable.INSTANCE);
- }
-
return treeElement;
}
@@ -508,7 +502,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
@Override
public boolean isWritable() {
- return getViewProvider().getVirtualFile().isWritable() && !CacheUtil.isCopy(this);
+ return getViewProvider().getVirtualFile().isWritable();
}
@Override
@@ -653,32 +647,6 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
}
}
- @Override
- public PsiFile cacheCopy(final FileContent content) {
- if (isContentsLoaded()) {
- return this;
- }
- else {
- CharSequence text;
- if (content == null) {
- Document document = FileDocumentManager.getInstance().getDocument(getVirtualFile());
- text = document.getCharsSequence();
- }
- else {
- text = CacheUtil.getContentText(content);
- }
-
- FileType fileType = getFileType();
- final String name = getName();
- PsiFile fileCopy =
- PsiFileFactory.getInstance(getProject()).createFileFromText(name, fileType, text, getModificationStamp(), false, false);
- fileCopy.putUserData(CacheUtil.CACHE_COPY_KEY, Boolean.TRUE);
-
- ((PsiFileImpl)fileCopy).setOriginalFile(this);
- return fileCopy;
- }
- }
-
@Nullable
public StubElement getStub() {
StubTree stubHolder = getStubTree();
diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java
index b3858c8f664f..e0d91f62eadc 100644
--- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java
+++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java
@@ -74,7 +74,12 @@ public class EditorHighlighterFactoryImpl extends EditorHighlighterFactory {
return editorHighlighter;
}
}
- return FileTypeEditorHighlighterProviders.INSTANCE.forFileType(fileType).getEditorHighlighter(project, fileType, vFile, settings);
+ try {
+ return FileTypeEditorHighlighterProviders.INSTANCE.forFileType(fileType).getEditorHighlighter(project, fileType, vFile, settings);
+ }
+ catch (Exception e) {
+ LOG.error(e);
+ }
}
SyntaxHighlighter highlighter = null;
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/LightPsiFileImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/LightPsiFileImpl.java
index 7d25327c607e..8a637369101d 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/LightPsiFileImpl.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/LightPsiFileImpl.java
@@ -16,7 +16,6 @@
package com.intellij.psi.impl.source;
-import com.intellij.ide.caches.FileContent;
import com.intellij.ide.util.PsiNavigationSupport;
import com.intellij.lang.FileASTNode;
import com.intellij.lang.Language;
@@ -270,11 +269,6 @@ public abstract class LightPsiFileImpl extends PsiElementBase implements PsiFile
public void onContentReload() {
}
- @Override
- public PsiFile cacheCopy(final FileContent content) {
- return this;
- }
-
@Override
public boolean isWritable() {
return getViewProvider().getVirtualFile().isWritable();
diff --git a/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurableWithChangeSupport.java b/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurableWithChangeSupport.java
index 03dff4f31208..85f6463c439a 100644
--- a/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurableWithChangeSupport.java
+++ b/platform/platform-api/src/com/intellij/openapi/options/BaseConfigurableWithChangeSupport.java
@@ -15,28 +15,28 @@
*/
package com.intellij.openapi.options;
-import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.EventDispatcher;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
-import java.util.List;
public abstract class BaseConfigurableWithChangeSupport extends BaseConfigurable {
- private final List myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
+ private final EventDispatcher myDispatcher = EventDispatcher.create(ChangeListener.class);
- public void setModified(final boolean modified) {
+ public void setModified(boolean modified) {
fireStateChanged();
super.setModified(modified);
}
- public void addChangeListener(final ChangeListener listener) {
- myListeners.add(listener);
+ public void addChangeListener(ChangeListener listener) {
+ myDispatcher.addListener(listener);
+ }
+
+ public void removeChangeListener(ChangeListener listener) {
+ myDispatcher.addListener(listener);
}
public void fireStateChanged() {
- final ChangeEvent event = new ChangeEvent(this);
- for (final ChangeListener listener : myListeners) {
- listener.stateChanged(event);
- }
+ myDispatcher.getMulticaster().stateChanged(new ChangeEvent(this));
}
}
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java
index 41c6b74eb9e2..eda48cc3be03 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/popup/ComponentPopupBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.intellij.openapi.ui.popup;
import com.intellij.openapi.project.Project;
@@ -37,15 +36,14 @@ import java.util.List;
* @author max
*/
public interface ComponentPopupBuilder {
-
@NotNull
ComponentPopupBuilder setTitle(String title);
@NotNull
- ComponentPopupBuilder setResizable(final boolean forceResizable);
+ ComponentPopupBuilder setResizable(boolean forceResizable);
@NotNull
- ComponentPopupBuilder setMovable(final boolean forceMovable);
+ ComponentPopupBuilder setMovable(boolean forceMovable);
@NotNull
ComponentPopupBuilder setRequestFocus(boolean requestFocus);
@@ -56,20 +54,14 @@ public interface ComponentPopupBuilder {
@NotNull
ComponentPopupBuilder setRequestFocusCondition(Project project, Condition condition);
- /**
- * @deprecated all popups are heavyweight now, lightweight popups no linger supported
- */
- @NotNull
- ComponentPopupBuilder setForceHeavyweight(boolean forceHeavyweight);
-
/**
* @see com.intellij.openapi.util.DimensionService
*/
@NotNull
- ComponentPopupBuilder setDimensionServiceKey(@Nullable final Project project, @NonNls final String dimensionServiceKey, final boolean useForXYLocation);
+ ComponentPopupBuilder setDimensionServiceKey(@Nullable Project project, @NonNls String key, boolean useForXYLocation);
@NotNull
- ComponentPopupBuilder setCancelCallback(final Computable shouldProceed);
+ ComponentPopupBuilder setCancelCallback(Computable shouldProceed);
@NotNull
ComponentPopupBuilder setCancelOnClickOutside(boolean cancel);
@@ -78,7 +70,7 @@ public interface ComponentPopupBuilder {
ComponentPopupBuilder addListener(JBPopupListener listener);
@NotNull
- ComponentPopupBuilder setCancelOnMouseOutCallback(final MouseChecker shouldCancel);
+ ComponentPopupBuilder setCancelOnMouseOutCallback(MouseChecker shouldCancel);
@NotNull
JBPopup createPopup();
@@ -89,34 +81,41 @@ public interface ComponentPopupBuilder {
@NotNull
ComponentPopupBuilder setCancelOnOtherWindowOpen(boolean cancelOnWindow);
- @NotNull ComponentPopupBuilder setTitleIcon(@NotNull ActiveIcon icon);
-
- @NotNull ComponentPopupBuilder setCancelKeyEnabled(boolean enabled);
-
- @NotNull ComponentPopupBuilder setLocateByContent(boolean byContent);
+ @NotNull
+ ComponentPopupBuilder setTitleIcon(@NotNull ActiveIcon icon);
- @NotNull ComponentPopupBuilder setLocateWithinScreenBounds(boolean within);
+ @NotNull
+ ComponentPopupBuilder setCancelKeyEnabled(boolean enabled);
- @NotNull ComponentPopupBuilder setMinSize(Dimension minSize);
+ @NotNull
+ ComponentPopupBuilder setLocateByContent(boolean byContent);
- @NotNull ComponentPopupBuilder setAlpha(float alpha);
+ @NotNull
+ ComponentPopupBuilder setLocateWithinScreenBounds(boolean within);
- @NotNull ComponentPopupBuilder setBelongsToGlobalPopupStack(boolean isInStack);
+ @NotNull
+ ComponentPopupBuilder setMinSize(Dimension minSize);
- @NotNull ComponentPopupBuilder setProject(Project project);
+ @NotNull
+ ComponentPopupBuilder setAlpha(float alpha);
- @NotNull ComponentPopupBuilder addUserData(Object object);
+ @NotNull
+ ComponentPopupBuilder setBelongsToGlobalPopupStack(boolean isInStack);
- @NotNull ComponentPopupBuilder setModalContext(boolean modal);
+ @NotNull
+ ComponentPopupBuilder setProject(Project project);
+
+ @NotNull
+ ComponentPopupBuilder addUserData(Object object);
+
+ @NotNull
+ ComponentPopupBuilder setModalContext(boolean modal);
@NotNull
ComponentPopupBuilder setFocusOwners(@NotNull Component[] focusOwners);
/**
* Adds "advertising" text to the bottom (e.g.: hints in code completion popup).
- *
- * @param text Text to set.
- * @return This.
*/
@NotNull
ComponentPopupBuilder setAdText(@Nullable String text);
@@ -124,7 +123,8 @@ public interface ComponentPopupBuilder {
@NotNull
ComponentPopupBuilder setAdText(@Nullable String text, int textAlignment);
- @NotNull ComponentPopupBuilder setShowShadow(boolean show);
+ @NotNull
+ ComponentPopupBuilder setShowShadow(boolean show);
@NotNull
ComponentPopupBuilder setCommandButton(@NotNull ActiveComponent commandButton);
@@ -144,11 +144,11 @@ public interface ComponentPopupBuilder {
ComponentPopupBuilder setCancelOnWindowDeactivation(boolean cancelOnWindowDeactivation);
/**
- * Allows to define custom strategy for processing {@link JBPopup#dispatchKeyEvent(KeyEvent)}
- *
- * @param handler strategy to use
- * @return this
+ * Allows to define custom strategy for processing {@link JBPopup#dispatchKeyEvent(KeyEvent)}.
*/
@NotNull
ComponentPopupBuilder setKeyEventHandler(@NotNull BooleanFunction handler);
+
+ @NotNull
+ ComponentPopupBuilder setShowBorder(boolean show);
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java b/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java
index 51ffc7915107..e0c9373bbf2b 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/AboutAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -21,32 +21,34 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.wm.WindowManager;
+import org.jetbrains.annotations.Nullable;
import java.awt.*;
public class AboutAction extends AnAction implements DumbAware {
-
+ @Override
public void update(AnActionEvent e) {
e.getPresentation().setVisible(!SystemInfo.isMacSystemMenu);
e.getPresentation().setDescription("Show information about " + ApplicationNamesInfo.getInstance().getFullProductName());
}
+ @Override
public void actionPerformed(AnActionEvent e) {
- Window window = WindowManager.getInstance().suggestParentWindow(e.getData(CommonDataKeys.PROJECT));
-
+ Project project = e.getData(CommonDataKeys.PROJECT);
+ Window window = WindowManager.getInstance().suggestParentWindow(project);
showAboutDialog(window);
}
public static void showAbout() {
- Window window = WindowManager.getInstance().suggestParentWindow(
- CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext()));
-
+ @SuppressWarnings("deprecation") Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
+ Window window = WindowManager.getInstance().suggestParentWindow(project);
showAboutDialog(window);
}
- private static void showAboutDialog(Window window) {
- new AboutDialog(window).setVisible(true);
+ private static void showAboutDialog(@Nullable Window window) {
+ new AboutPopup().show(window);
}
}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/AboutDialog.java b/platform/platform-impl/src/com/intellij/ide/actions/AboutPopup.java
similarity index 64%
rename from platform/platform-impl/src/com/intellij/ide/actions/AboutDialog.java
rename to platform/platform-impl/src/com/intellij/ide/actions/AboutPopup.java
index 015afd344dd9..42eed245bbd0 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/AboutDialog.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/AboutPopup.java
@@ -24,22 +24,23 @@ import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.IconLoader;
-import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.wm.IdeFocusManager;
-import com.intellij.ui.ClickListener;
import com.intellij.ui.LicensingFacade;
import com.intellij.ui.UI;
+import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.UIUtil;
-import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
-import java.awt.event.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -49,137 +50,93 @@ import java.util.Properties;
/**
* @author Konstantin Bulenkov
*/
-@SuppressWarnings("SSBasedInspection")
-public class AboutDialog extends JDialog {
-
- public AboutDialog(Window owner) {
- super(owner);
- init(owner);
- }
-
-
- private void init(Window window) {
+public class AboutPopup {
+ public void show(@Nullable Window window) {
ApplicationInfoEx appInfo = (ApplicationInfoEx)ApplicationInfo.getInstance();
- JPanel mainPanel = new JPanel(new BorderLayout());
- mainPanel.setFocusable(true); //doesn't work under Oracle 1.7 if nothing focusable
- final JComponent closeListenerOwner;
+
+ JPanel panel = new JPanel(new BorderLayout());
Icon image = IconLoader.getIcon(appInfo.getAboutImageUrl());
- final InfoSurface infoSurface;
if (appInfo.showLicenseeInfo()) {
- infoSurface = new InfoSurface(image);
+ final InfoSurface infoSurface = new InfoSurface(image);
infoSurface.setPreferredSize(new Dimension(image.getIconWidth(), image.getIconHeight()));
- mainPanel.add(infoSurface, BorderLayout.NORTH);
+ panel.add(infoSurface, BorderLayout.NORTH);
- closeListenerOwner = infoSurface;
- }
- else {
- infoSurface = null;
- mainPanel.add(new JLabel(image), BorderLayout.NORTH);
- closeListenerOwner = mainPanel;
- }
- setUndecorated(true);
- setContentPane(mainPanel);
- final Ref showTime = Ref.create(System.currentTimeMillis());
-
- new DumbAwareAction() {
- @Override
- public void actionPerformed(AnActionEvent e) {
- if (infoSurface != null) {
+ new DumbAwareAction() {
+ @Override
+ public void actionPerformed(AnActionEvent e) {
copyInfoToClipboard(infoSurface.getText());
}
- }
- }.registerCustomShortcutSet(CustomShortcutSet.fromString("meta C", "control C"), mainPanel);
+ }.registerCustomShortcutSet(CustomShortcutSet.fromString("meta C", "control C"), panel);
+ }
+ else {
+ panel.add(new JLabel(image), BorderLayout.NORTH);
+ }
- new DumbAwareAction() {
+ RelativePoint location;
+ if (window != null) {
+ Rectangle r = window.getBounds();
+ location = new RelativePoint(window, new Point((r.width - image.getIconWidth()) / 2, (r.height - image.getIconHeight()) / 2));
+ }
+ else {
+ Rectangle r = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds();
+ location = new RelativePoint(new Point((r.width - image.getIconWidth()) / 2, (r.height - image.getIconHeight()) / 2));
+ }
- @Override
- public void actionPerformed(AnActionEvent e) {
- dispose();
- }
- }.registerCustomShortcutSet(CustomShortcutSet.fromString("ESCAPE"), mainPanel);
-
- //final long delta = Patches.APPLE_BUG_ID_3716865 ? 100 : 0;
- final long delta = 500; //reproducible on Windows too
-
- addWindowFocusListener(new WindowFocusListener() {
- public void windowGainedFocus(WindowEvent e) {
- }
-
- public void windowLostFocus(WindowEvent e) {
- if (e.getOppositeWindow() == null) return;
- long eventTime = System.currentTimeMillis();
- if (eventTime - showTime.get() > delta && e.getOppositeWindow() != e.getWindow()) {
- dispose();
- }
- else {
- IdeFocusManager.getGlobalInstance().requestFocus(AboutDialog.this, true);
- }
- }
- });
-
- new ClickListener() {
- @Override
- public boolean onClick(@NotNull MouseEvent event, int clickCount) {
- dispose();
- return true;
- }
- }.installOn(closeListenerOwner);
-
- pack();
-
- setLocationRelativeTo(window);
+ JBPopupFactory.getInstance().createComponentPopupBuilder(panel, panel)
+ .setRequestFocus(true)
+ .setFocusable(true)
+ .setResizable(false)
+ .setMovable(false)
+ .setModalContext(false)
+ .setShowShadow(true)
+ .setShowBorder(false)
+ .setCancelKeyEnabled(true)
+ .setCancelOnClickOutside(true)
+ .setCancelOnOtherWindowOpen(true)
+ .createPopup()
+ .show(location);
}
private static void copyInfoToClipboard(String text) {
try {
CopyPasteManager.getInstance().setContents(new StringSelection(text));
}
- catch (Exception ignore) {
- }
+ catch (Exception ignore) { }
}
private static class InfoSurface extends JPanel {
- final Color col;
- final Color linkCol;
+ private final Color myColor;
+ private final Color myLinkColor;
private final Icon myImage;
private Font myFont;
private Font myBoldFont;
private final List myLines = new ArrayList();
private StringBuilder myInfo = new StringBuilder();
-
- private static class Link {
- private final Rectangle rectangle;
- private final String url;
-
- private Link(Rectangle rectangle, String url) {
- this.rectangle = rectangle;
- this.url = url;
- }
- }
-
+ private final List myLinks = new ArrayList();
private Link myActiveLink;
- private final List myLinks = new ArrayList();
-
public InfoSurface(Icon image) {
+ ApplicationInfoImpl appInfo = (ApplicationInfoImpl)ApplicationInfoEx.getInstanceEx();
+
myImage = image;
+ //noinspection UseJBColor
+ myColor = Color.white;
+ myLinkColor = appInfo.getAboutLinkColor() != null ? appInfo.getAboutLinkColor() : UI.getColor("link.foreground");
setOpaque(false);
- col = Color.white;
- final ApplicationInfoImpl ideInfo = (ApplicationInfoImpl)ApplicationInfoEx.getInstanceEx();
- linkCol = ideInfo.getAboutLinkColor() != null ? ideInfo.getAboutLinkColor() : UI.getColor("link.foreground");
- setBackground(col);
- Calendar cal = ideInfo.getBuildDate();
- myLines.add(new AboutBoxLine(ideInfo.getFullApplicationName(), true, null));
+ setBackground(myColor);
+
+ Calendar cal = appInfo.getBuildDate();
+ myLines.add(new AboutBoxLine(appInfo.getFullApplicationName(), true, null));
appendLast();
- String buildInfo = IdeBundle.message("aboutbox.build.number", ideInfo.getBuild().asString());
+ String buildInfo = IdeBundle.message("about.box.build.number", appInfo.getBuild().asString());
String buildDate = "";
- if (ideInfo.getBuild().isSnapshot()) {
+ if (appInfo.getBuild().isSnapshot()) {
buildDate = new SimpleDateFormat("HH:mm, ").format(cal.getTime());
}
buildDate += DateFormatUtil.formatAboutDialogDate(cal.getTime());
- buildInfo += IdeBundle.message("aboutbox.build.date", buildDate);
+ buildInfo += IdeBundle.message("about.box.build.date", buildDate);
myLines.add(new AboutBoxLine(buildInfo));
appendLast();
@@ -192,23 +149,21 @@ public class AboutDialog extends JDialog {
myLines.add(new AboutBoxLine(message));
}
}
+
myLines.add(new AboutBoxLine(""));
- final Properties properties = System.getProperties();
- final String javaVersion = properties.getProperty("java.runtime.version", properties.getProperty("java.version", "unknown"));
- final String arch = properties.getProperty("os.arch", "");
- myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.jdk", javaVersion, arch), true, null));
- appendLast();
- myLines.add(new AboutBoxLine(IdeBundle.message("aboutbox.vm", properties.getProperty("java.vm.name", "unknown"),
- properties.getProperty("java.vendor", "unknown"))));
+ Properties properties = System.getProperties();
+ String javaVersion = properties.getProperty("java.runtime.version", properties.getProperty("java.version", "unknown"));
+ String arch = properties.getProperty("os.arch", "");
+ myLines.add(new AboutBoxLine(IdeBundle.message("about.box.jre", javaVersion, arch)));
appendLast();
- /*
- myLines.add(new AboutBoxLine(""));
- myLines.add(new AboutBoxLine(info.getCompanyURL(), true, info.getCompanyURL()));
- */
+ String vmVersion = properties.getProperty("java.vm.name", "unknown");
+ String vmVendor = properties.getProperty("java.vendor", "unknown");
+ myLines.add(new AboutBoxLine(IdeBundle.message("about.box.vm", vmVersion, vmVendor)));
+ appendLast();
- String thirdParty = ideInfo.getThirdPartySoftwareURL();
+ String thirdParty = appInfo.getThirdPartySoftwareURL();
if (thirdParty != null) {
myLines.add(new AboutBoxLine(""));
myLines.add(new AboutBoxLine(""));
@@ -217,19 +172,22 @@ public class AboutDialog extends JDialog {
}
addMouseListener(new MouseAdapter() {
+ @Override
public void mousePressed(MouseEvent event) {
if (myActiveLink != null) {
event.consume();
- BrowserUtil.browse(myActiveLink.url);
+ BrowserUtil.browse(myActiveLink.myUrl);
}
}
});
+
addMouseMotionListener(new MouseMotionAdapter() {
+ @Override
public void mouseMoved(MouseEvent event) {
boolean hadLink = (myActiveLink != null);
myActiveLink = null;
for (Link link : myLinks) {
- if (link.rectangle.contains(event.getPoint())) {
+ if (link.myRectangle.contains(event.getPoint())) {
myActiveLink = link;
if (!hadLink) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@@ -251,6 +209,7 @@ public class AboutDialog extends JDialog {
@Override
protected void paintChildren(Graphics g) {
super.paintChildren(g);
+
Graphics2D g2 = (Graphics2D)g;
UIUtil.applyRenderingHints(g);
@@ -258,12 +217,13 @@ public class AboutDialog extends JDialog {
if (SystemInfo.isWindows) {
labelFont = new Font("Tahoma", Font.PLAIN, 12);
}
+
for (int labelSize = 10; labelSize != 6; labelSize -= 1) {
myLinks.clear();
- g2.setPaint(col);
+ g2.setPaint(myColor);
myImage.paintIcon(this, g2, 0, 0);
- g2.setColor(col);
+ g2.setColor(myColor);
TextRenderer renderer = new TextRenderer(0, 165, 398, 120, g2);
UIUtil.setupComposite(g2);
myFont = labelFont.deriveFont(Font.PLAIN, labelSize);
@@ -272,8 +232,7 @@ public class AboutDialog extends JDialog {
renderer.render(30, 0, myLines);
break;
}
- catch (TextRenderer.OverflowException ignore) {
- }
+ catch (TextRenderer.OverflowException ignore) { }
}
ApplicationInfo appInfo = ApplicationInfo.getInstance();
@@ -287,7 +246,7 @@ public class AboutDialog extends JDialog {
return myInfo.toString();
}
- public class TextRenderer {
+ private class TextRenderer {
private final int xBase;
private final int yBase;
private final int w;
@@ -301,8 +260,7 @@ public class AboutDialog extends JDialog {
private int fontHeight;
private Font font;
- public class OverflowException extends Exception {
- }
+ public class OverflowException extends Exception { }
public TextRenderer(final int xBase, final int yBase, final int w, final int h, final Graphics2D g2) {
this.xBase = xBase;
@@ -324,7 +282,7 @@ public class AboutDialog extends JDialog {
final String s = line.getText();
setFont(line.isBold() ? myBoldFont : myFont);
if (line.getUrl() != null) {
- g2.setColor(linkCol);
+ g2.setColor(myLinkColor);
FontMetrics metrics = g2.getFontMetrics(font);
myLinks.add(new Link(new Rectangle(x, yBase + y - fontAscent, metrics.stringWidth(s), fontHeight), line.getUrl()));
}
@@ -390,45 +348,55 @@ public class AboutDialog extends JDialog {
fontHeight = fontmetrics.getHeight();
}
}
- }
- private static class AboutBoxLine {
- private final String myText;
- private final boolean myBold;
- private final String myUrl;
- private boolean myKeepWithNext;
+ private static class AboutBoxLine {
+ private final String myText;
+ private final boolean myBold;
+ private final String myUrl;
+ private boolean myKeepWithNext;
- public AboutBoxLine(final String text, final boolean bold, final String url) {
- myText = text;
- myBold = bold;
- myUrl = url;
+ public AboutBoxLine(final String text, final boolean bold, final String url) {
+ myText = text;
+ myBold = bold;
+ myUrl = url;
+ }
+
+ public AboutBoxLine(final String text) {
+ myText = text;
+ myBold = false;
+ myUrl = null;
+ }
+
+ public String getText() {
+ return myText;
+ }
+
+ public boolean isBold() {
+ return myBold;
+ }
+
+ public String getUrl() {
+ return myUrl;
+ }
+
+ public boolean isKeepWithNext() {
+ return myKeepWithNext;
+ }
+
+ public AboutBoxLine keepWithNext() {
+ myKeepWithNext = true;
+ return this;
+ }
}
- public AboutBoxLine(final String text) {
- myText = text;
- myBold = false;
- myUrl = null;
- }
+ private static class Link {
+ private final Rectangle myRectangle;
+ private final String myUrl;
- public String getText() {
- return myText;
- }
-
- public boolean isBold() {
- return myBold;
- }
-
- public String getUrl() {
- return myUrl;
- }
-
- public boolean isKeepWithNext() {
- return myKeepWithNext;
- }
-
- public AboutBoxLine keepWithNext() {
- myKeepWithNext = true;
- return this;
+ private Link(Rectangle rectangle, String url) {
+ myRectangle = rectangle;
+ myUrl = url;
+ }
}
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
index 0e2e240d9571..0d3070f97aea 100644
--- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java
@@ -818,7 +818,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
}
int exitCode = 0;
- if (restart) {
+ if (restart && Restarter.isSupported()) {
try {
exitCode = Restarter.scheduleRestart();
}
@@ -1026,7 +1026,8 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
if (myHeadlessMode) return;
if (!isReadAccessAllowed()) {
LOG.error(
- "Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())",
+ "Read access is allowed from event dispatch thread or inside read-action only" +
+ " (see com.intellij.openapi.application.Application.runReadAction())",
"Current thread: " + describe(Thread.currentThread()), "Our dispatch thread:" + describe(ourDispatchThread),
"SystemEventQueueThread: " + describe(getEventQueueThread()));
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java
index 8d3d0c15b0f8..ec32bd1a6f2c 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeMenuBar.java
@@ -154,14 +154,14 @@ public class IdeMenuBar extends JMenuBar implements IdeEventQueue.EventDispatche
@Override
public void doLayout() {
super.doLayout();
- if (myClockPanel != null) {
+ if (myClockPanel != null && myButton != null) {
if (myState != State.EXPANDED) {
myClockPanel.setVisible(true);
myButton.setVisible(true);
- Dimension preferredSize = myClockPanel.getPreferredSize();
- myClockPanel.setBounds(getBounds().width - preferredSize.width, 0, preferredSize.width, preferredSize.height);
- preferredSize = myButton.getPreferredSize();
- myButton.setBounds(getBounds().width - preferredSize.width * 2 - myClockPanel.getWidth(), 0, preferredSize.width, preferredSize.height);
+ Dimension preferredSize = myButton.getPreferredSize();
+ myButton.setBounds(getBounds().width - preferredSize.width, 0, preferredSize.width, preferredSize.height);
+ preferredSize = myClockPanel.getPreferredSize();
+ myClockPanel.setBounds(getBounds().width - preferredSize.width - myButton.getWidth(), 0, preferredSize.width, preferredSize.height);
}
else {
myClockPanel.setVisible(false);
diff --git a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
index 586f76b64f36..108b2fdf4fd9 100755
--- a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
+++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
@@ -16,25 +16,18 @@
package com.intellij.ui.messages;
import com.intellij.icons.AllIcons;
-import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.ui.AppUIUtil;
import com.intellij.ui.Gray;
import com.intellij.ui.JBColor;
import com.intellij.util.ui.UIUtil;
import org.jdesktop.swingx.graphics.GraphicsUtilities;
import org.jdesktop.swingx.graphics.ShadowRenderer;
-import javax.imageio.ImageIO;
import javax.swing.*;
-import javax.swing.plaf.UIResource;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
/**
* Created by Denis Fokin
@@ -260,7 +253,7 @@ public class SheetController {
recalculateShadow();
- sheetPanel.setSize(SHEET_NC_WIDTH, SHEET_NC_HEIGHT );
+ sheetPanel.setSize(SHEET_NC_WIDTH + 200, SHEET_NC_HEIGHT + 200);
return sheetPanel;
}
@@ -281,14 +274,16 @@ public class SheetController {
private void paintShadow(Graphics2D g2d) {
- if (myOffscreenShadowImage.getWidth() != SHEET_NC_WIDTH || myOffscreenShadowImage.getHeight() != SHEET_HEIGHT) {
- myOffscreenShadowImage = GraphicsUtilities.createCompatibleTranslucentImage(
- SHEET_WIDTH, SHEET_HEIGHT);
+ if (myOffscreenShadowImage.getWidth() != SHEET_WIDTH || myOffscreenShadowImage.getHeight() != SHEET_HEIGHT) {
+ myOffscreenShadowImage = new BufferedImage(SHEET_WIDTH, SHEET_HEIGHT, BufferedImage.TYPE_INT_ARGB);
}
+ g2d.setBackground(new JBColor(new Color(255, 255, 255, 0), new Color(110, 110, 110, 0)));
+ g2d.clearRect(0, 0, SHEET_NC_WIDTH, SHEET_NC_HEIGHT);
+
Graphics2D g2 = myOffscreenShadowImage.createGraphics();
g2.setColor(new JBColor(Gray._255, Gray._0));
- g2.fillRoundRect(0, 0, SHEET_WIDTH - 1, SHEET_HEIGHT - 1, SHADOW_BORDER, SHADOW_BORDER);
+ g2.fillRect(0, 0, SHEET_WIDTH, SHEET_HEIGHT);
g2.dispose();
ShadowRenderer renderer = new ShadowRenderer();
@@ -296,9 +291,9 @@ public class SheetController {
renderer.setOpacity(.95f);
renderer.setColor(new JBColor(JBColor.BLACK, Gray._10));
BufferedImage shadow = renderer.createShadow(myOffscreenShadowImage);
- g2d.drawImage(shadow, 0, - SHADOW_BORDER, null);
- g2d.setBackground(new JBColor(new Color(255, 255, 255, 0), new Color(110, 110, 110, 0)));
- g2d.clearRect(SHADOW_BORDER, 0, SHEET_WIDTH, SHEET_HEIGHT);
+ g2d.drawImage(shadow, 0, -SHADOW_BORDER, null);
+ //g2d.setBackground(new JBColor(new Color(255, 255, 255, 0), new Color(110, 110, 110, 0)));
+ //g2d.clearRect(SHADOW_BORDER, 0, SHEET_WIDTH, SHEET_HEIGHT);
}
private void layoutButtons(final JButton[] buttons, JPanel panel) {
@@ -347,9 +342,13 @@ public class SheetController {
myOffScreenFrame.add(mySheetPanel);
myOffScreenFrame.getRootPane().setDefaultButton(myDefaultButton);
- final BufferedImage image = UIUtil.createImage(SHEET_NC_WIDTH, SHEET_NC_HEIGHT, BufferedImage.TYPE_INT_ARGB);
+ final BufferedImage image = new BufferedImage(SHEET_NC_WIDTH, SHEET_NC_HEIGHT, BufferedImage.TYPE_INT_ARGB);
+
+ Graphics g = image.createGraphics();
+ mySheetPanel.paint(g);
+
+ g.dispose();
- mySheetPanel.paint(image.createGraphics());
myOffScreenFrame.dispose();
return image;
}
diff --git a/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java b/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java
index 24392475d53b..e54589454afc 100755
--- a/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java
+++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java
@@ -105,6 +105,9 @@ public class SheetMessage {
if (staticImage != null) {
Graphics2D g2d = (Graphics2D) g.create();
+ g2d.setBackground(new JBColor(new Color(255, 255, 255, 0), new Color(110, 110, 110, 0)));
+ g2d.clearRect(0, 0, myController.SHEET_NC_WIDTH, myController.SHEET_NC_HEIGHT);
+
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.95f));
int imageCropOffset = (UIUtil.isRetina()) ? imageHeight * 2 : imageHeight;
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
index 0e09ea52214d..f3b20876915e 100644
--- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
+++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
@@ -57,20 +57,19 @@ import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class AbstractPopup implements JBPopup {
+ public static final String SHOW_HINTS = "ShowHints";
+
private static final Logger LOG = Logger.getInstance("#com.intellij.ui.popup.AbstractPopup");
private static final Object SUPPRESS_MAC_CORNER = new Object();
- @NonNls public static final String SHOW_HINTS = "ShowHints";
- /**
- * X server sometimes focuses focusable popups upon appearance, ignoring the fact that we didn't ask to focus them
- */
- private static final boolean ourXWindowIDEA94683FocusBug = SystemInfo.isXWindow;
+
+ // X server sometimes focuses focusable popups upon appearance, ignoring the fact that we didn't ask to focus them (IDEA-94683)
+ private static final boolean X_WINDOW_FOCUS_BUG = SystemInfo.isXWindow;
private PopupComponent myPopup;
private MyContentPanel myContent;
@@ -99,9 +98,8 @@ public class AbstractPopup implements JBPopup {
private boolean myLocateByContent;
protected FocusTrackback myFocusTrackback;
private Dimension myMinSize;
- private ArrayList