mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -315,8 +315,6 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
|
||||
// product specific custom layout
|
||||
customLayout(targetDirectory)
|
||||
|
||||
printUnusedModules(info.usedModules)
|
||||
|
||||
reorder(home, targetDirectory)
|
||||
return info
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ contributor ([ctx], {
|
||||
method name:"findModule", type:"org.jetbrains.jps.model.module.JpsModule", params:[name:"String"]
|
||||
method name:"requireProperty", type:"String", params:[key:"String"]
|
||||
method name:"requireProperty", type:"String", params:[key:"String", defaultValue:"String"]
|
||||
method name:"printUnusedModules", type:"void", params:[usedModules:"java.util.Set<String>"]
|
||||
method name:"notifyArtifactBuilt", type:"void", params:[artifactPath:"String"]
|
||||
property name: "productProperties", type: "ProductProperties"
|
||||
})
|
||||
@@ -246,14 +246,6 @@ binding.setVariable("allModules", {
|
||||
return project.modules
|
||||
})
|
||||
|
||||
binding.setVariable("printUnusedModules", {Set<String> usedModules ->
|
||||
allModules().each {JpsModule m ->
|
||||
if (!usedModules.contains(m.name) && hasSourceRoots(m)) {
|
||||
projectBuilder.warning("Module $m.name is not used in project layout")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
requireProperty("home", guessHome())
|
||||
|
||||
String readSnapshotBuild() {
|
||||
|
||||
@@ -46,7 +46,8 @@ class EmptyFileManager implements FileManager {
|
||||
|
||||
@Override
|
||||
public PsiFile findFile(@NotNull VirtualFile vFile) {
|
||||
return null;
|
||||
FileViewProvider viewProvider = findViewProvider(vFile);
|
||||
return viewProvider == null ? null : viewProvider.getPsi(viewProvider.getBaseLanguage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.psi.impl.smartPointers;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.LanguageUtil;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -34,18 +35,14 @@ import org.jetbrains.annotations.Nullable;
|
||||
* User: cdr
|
||||
*/
|
||||
class FileElementInfo extends SmartPointerElementInfo {
|
||||
protected final VirtualFile myVirtualFile;
|
||||
protected final Project myProject;
|
||||
protected final Language myLanguage;
|
||||
private final VirtualFile myVirtualFile;
|
||||
private final Project myProject;
|
||||
private final Language myLanguage;
|
||||
|
||||
public FileElementInfo(@NotNull PsiFile file) {
|
||||
this(file.getProject(), file.getVirtualFile(), file.getLanguage());
|
||||
}
|
||||
|
||||
protected FileElementInfo(@NotNull Project project, VirtualFile virtualFile, Language lang) {
|
||||
myVirtualFile = virtualFile;
|
||||
myProject = project;
|
||||
myLanguage = lang;
|
||||
public FileElementInfo(@NotNull final PsiFile file) {
|
||||
myVirtualFile = file.getVirtualFile();
|
||||
myProject = file.getProject();
|
||||
myLanguage = LanguageUtil.getRootLanguage(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+14
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -34,11 +34,24 @@ public interface ApplicationActivationListener {
|
||||
*/
|
||||
void applicationDeactivated(IdeFrame ideFrame);
|
||||
|
||||
/**
|
||||
* This is more precise notification than {code applicationDeactivated} callback.
|
||||
* It is intended for focus subsystem and purposes where we do not want
|
||||
* to be bothered by false application deactivation events.
|
||||
*
|
||||
* The shortcoming of the method is that a notification is delivered
|
||||
* with a delay. See {code app.deactivation.timeout} key in the registry
|
||||
*/
|
||||
void delayedApplicationDeactivated(IdeFrame ideFrame);
|
||||
|
||||
abstract class Adapter implements ApplicationActivationListener {
|
||||
@Override
|
||||
public void applicationActivated(IdeFrame ideFrame) { }
|
||||
|
||||
@Override
|
||||
public void applicationDeactivated(IdeFrame ideFrame) { }
|
||||
|
||||
@Override
|
||||
public void delayedApplicationDeactivated(IdeFrame ideFrame) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationActivationListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.impl.ApplicationImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* @author Denis Fokin
|
||||
*/
|
||||
public class ApplicationActivationStateManager {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.ApplicationActivationStateManager");
|
||||
|
||||
private static AtomicLong requestToDeactivateTime = new AtomicLong(System.currentTimeMillis());
|
||||
|
||||
private static ApplicationActivationStateManager instance = new ApplicationActivationStateManager();
|
||||
|
||||
public static ApplicationActivationStateManager get () {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private ApplicationActivationStateManager() {}
|
||||
|
||||
public enum State {
|
||||
ACTIVE,
|
||||
DEACTIVATED,
|
||||
DEACTIVATING;
|
||||
|
||||
public boolean isInactive () {
|
||||
return !this.equals(ACTIVE);
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.equals(ACTIVE);
|
||||
}
|
||||
};
|
||||
|
||||
private static State state = State.DEACTIVATED;
|
||||
|
||||
public static State getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public static boolean updateState (final WindowEvent windowEvent) {
|
||||
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
if (!(application instanceof ApplicationImpl)) return false;
|
||||
|
||||
final Window eventWindow = windowEvent.getWindow();
|
||||
|
||||
if (windowEvent.getID() == WindowEvent.WINDOW_ACTIVATED || windowEvent.getID() == WindowEvent.WINDOW_GAINED_FOCUS) {
|
||||
|
||||
if (state.isInactive()) {
|
||||
Window window = windowEvent.getWindow();
|
||||
|
||||
return setActive(application, window);
|
||||
}
|
||||
}
|
||||
else if (windowEvent.getID() == WindowEvent.WINDOW_DEACTIVATED && windowEvent.getOppositeWindow() != null) {
|
||||
requestToDeactivateTime.getAndSet(System.currentTimeMillis());
|
||||
|
||||
// For stuff that cannot wait windowEvent notify about deactivation immediately
|
||||
if (state.isActive()) {
|
||||
|
||||
IdeFrame ideFrame = getIdeFrameFromWindow(windowEvent.getWindow());
|
||||
if (ideFrame != null) {
|
||||
application.getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC).applicationDeactivated(ideFrame);
|
||||
}
|
||||
}
|
||||
|
||||
// We do not know for sure that application is going to be inactive,
|
||||
// windowEvent could just be showing a popup or another transient window.
|
||||
// So let's postpone the application deactivation for a while
|
||||
state = State.DEACTIVATING;
|
||||
LOG.info("SET APP DEACTIVATING");
|
||||
|
||||
Timer timer = new Timer(Registry.intValue("application.deactivation.timeout"), new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
|
||||
if (state.equals(State.DEACTIVATING)) {
|
||||
|
||||
state = State.DEACTIVATED;
|
||||
LOG.info("SET APP DEACTIVATED");
|
||||
|
||||
IdeFrame ideFrame = getIdeFrameFromWindow(windowEvent.getWindow());
|
||||
if (ideFrame != null) {
|
||||
application.getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC).delayedApplicationDeactivated(ideFrame);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
timer.setRepeats(false);
|
||||
timer.start();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean setActive(Application application, Window window) {
|
||||
IdeFrame ideFrame = getIdeFrameFromWindow(window);
|
||||
|
||||
state = State.ACTIVE;
|
||||
LOG.info("SET APP ACTIVE");
|
||||
|
||||
if (ideFrame != null) {
|
||||
application.getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC).applicationActivated(ideFrame);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void updateState(Window window) {
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
if (!(application instanceof ApplicationImpl)) return;
|
||||
|
||||
if (state.isInactive() && window != null) {
|
||||
setActive(application, window);
|
||||
}
|
||||
}
|
||||
|
||||
private static IdeFrame getIdeFrameFromWindow (Window window) {
|
||||
final Component frame = UIUtil.findUltimateParent(window);
|
||||
return (frame instanceof IdeFrame) ? (IdeFrame)frame : null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.impl.ApplicationImpl;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.diagnostic.FrequentEventDetector;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -39,7 +38,10 @@ import com.intellij.openapi.util.ExpirableRunnable;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
import com.intellij.openapi.wm.impl.FocusManagerImpl;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -524,9 +526,7 @@ public class IdeEventQueue extends EventQueue {
|
||||
|
||||
traceClipboardEvents(e);
|
||||
|
||||
if (e instanceof WindowEvent) {
|
||||
processAppActivationEvents((WindowEvent)e);
|
||||
}
|
||||
if (processAppActivationEvents(e)) return;
|
||||
|
||||
if (!typeAheadFlushing) {
|
||||
fixStickyFocusedComponents(e);
|
||||
@@ -816,32 +816,36 @@ public class IdeEventQueue extends EventQueue {
|
||||
return peekEvent(WindowEvent.WINDOW_OPENED) != null;
|
||||
}
|
||||
|
||||
private static final int APP_DEACTIVATION_DELAY = 50;
|
||||
private static final Alarm ourDeactivationAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
|
||||
private static boolean processAppActivationEvents(AWTEvent e) {
|
||||
|
||||
/*
|
||||
* This method processes "external" focus events (i.e. those induced by a window manager) and tracks
|
||||
* an application activation/deactivation state from them (an application is active if at least one it's windows has the focus).
|
||||
*
|
||||
* One special case is closing a child dialog: it generates a focus-lost event immediately followed by a focus-gained one.
|
||||
* To avoid (or rather reduce a chance of) unneeded app-deactivation event the processing of the focus-lost event
|
||||
* is slightly delayed.
|
||||
*/
|
||||
private static void processAppActivationEvents(final WindowEvent e) {
|
||||
if ((e.getID() == WindowEvent.WINDOW_GAINED_FOCUS || e.getID() == WindowEvent.WINDOW_LOST_FOCUS) && e.getOppositeWindow() == null) {
|
||||
final Application app = ApplicationManager.getApplication();
|
||||
if (app instanceof ApplicationImpl) {
|
||||
if (e.getID() == WindowEvent.WINDOW_GAINED_FOCUS) {
|
||||
ourDeactivationAlarm.cancelAllRequests();
|
||||
((ApplicationImpl)app).tryToApplyActivationState(e.getWindow(), true);
|
||||
}
|
||||
else {
|
||||
ourDeactivationAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((ApplicationImpl)app).tryToApplyActivationState(e.getWindow(), false);
|
||||
if (e instanceof WindowEvent) {
|
||||
final WindowEvent we = (WindowEvent)e;
|
||||
|
||||
ApplicationActivationStateManager.get().updateState(we);
|
||||
|
||||
storeLastFocusedComponent(we);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void storeLastFocusedComponent(WindowEvent we) {
|
||||
final Window eventWindow = we.getWindow();
|
||||
|
||||
if (we.getID() == WindowEvent.WINDOW_DEACTIVATED || we.getID() == WindowEvent.WINDOW_LOST_FOCUS) {
|
||||
Component frame = UIUtil.findUltimateParent(eventWindow);
|
||||
Component focusOwnerInDeactivatedWindow = eventWindow.getMostRecentFocusOwner();
|
||||
IdeFrame[] allProjectFrames = WindowManager.getInstance().getAllProjectFrames();
|
||||
|
||||
if (focusOwnerInDeactivatedWindow != null) {
|
||||
for (IdeFrame ideFrame : allProjectFrames) {
|
||||
JFrame aFrame = WindowManager.getInstance().getFrame(ideFrame.getProject());
|
||||
if (aFrame.equals(frame)) {
|
||||
IdeFocusManager focusManager = IdeFocusManager.getGlobalInstance();
|
||||
if (focusManager instanceof FocusManagerImpl) {
|
||||
((FocusManagerImpl)focusManager).setLastFocusedAtDeactivation(ideFrame, focusOwnerInDeactivatedWindow);
|
||||
}
|
||||
}, APP_DEACTIVATION_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 425 B |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 425 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
+17
-1
@@ -20,6 +20,7 @@ import com.intellij.ide.ui.laf.darcula.ui.DarculaProgressBarUI;
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
@@ -83,12 +84,13 @@ public class MacIntelliJProgressBarUI extends DarculaProgressBarUI {
|
||||
}
|
||||
}
|
||||
|
||||
protected volatile int position = 0;
|
||||
@Override
|
||||
protected void paintIndeterminate(Graphics g, JComponent c) {
|
||||
Insets insets = progressBar.getInsets();
|
||||
int w = c.getWidth();
|
||||
int h = c.getHeight();
|
||||
int y = (h - HEIGHT) / 2;
|
||||
int y = (h - HEIGHT) / 2 + insets.top;
|
||||
int x = insets.left;
|
||||
|
||||
Icon icon;
|
||||
@@ -106,5 +108,19 @@ public class MacIntelliJProgressBarUI extends DarculaProgressBarUI {
|
||||
gg.dispose();
|
||||
icon = MacIntelliJIconCache.getIcon("progressRight", true, false);
|
||||
icon.paintIcon(c, g, stop, y);
|
||||
|
||||
Icon shadow = MacIntelliJIconCache.getIcon("progressShadow");
|
||||
int boxWidth = w - insets.left - insets.right;
|
||||
if (boxWidth <= 0) return;
|
||||
gg = g.create(0, 0, w, h);
|
||||
gg.setClip(new RoundRectangle2D.Double(insets.left, y, boxWidth, HEIGHT, HEIGHT, HEIGHT));
|
||||
shadow.paintIcon(c, gg, position, y);
|
||||
int xx = boxWidth - (position + shadow.getIconWidth());
|
||||
if (xx < 0) {
|
||||
shadow.paintIcon(c, gg, -xx - shadow.getIconWidth(), y);
|
||||
}
|
||||
position++;
|
||||
position = position % boxWidth;
|
||||
gg.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-41
@@ -57,7 +57,6 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.psi.PsiLock;
|
||||
import com.intellij.ui.Splash;
|
||||
@@ -126,8 +125,6 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
private boolean myLoaded;
|
||||
private static final String WAS_EVER_SHOWN = "was.ever.shown";
|
||||
|
||||
private volatile boolean myActive;
|
||||
|
||||
private static final int IS_EDT_FLAG = 1<<30; // we don't mess with sign bit since we want to do arithmetic
|
||||
private static final int IS_READ_LOCK_ACQUIRED_FLAG = 1<<29;
|
||||
|
||||
@@ -1179,46 +1176,18 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* !!!!! CAUTION !!!!!
|
||||
* !!!!! CAUTION !!!!!
|
||||
* !!!!! CAUTION !!!!!
|
||||
*
|
||||
* THIS IS AN "ABSOLUTELY-GURU METHOD".
|
||||
* NOBODY AND UNDER ANY CIRCUMSTANCES SHOULD ADD OTHER USAGES OF IT :)
|
||||
* ONLY DENIS IS PERMITTED TO USE THIS METHOD!!!
|
||||
*
|
||||
* !!!!! CAUTION !!!!!
|
||||
* !!!!! CAUTION !!!!!
|
||||
* !!!!! CAUTION !!!!!
|
||||
*
|
||||
* There are no legitimate usages of the method outside of IdeEventQueue.processAppActivationEvents()
|
||||
*/
|
||||
public void tryToApplyActivationState(Window window, boolean activation) {
|
||||
if (activation && !isActive()) {
|
||||
myActive = true;
|
||||
IdeFrame ideFrame = getIdeFrameFromWindow(window);
|
||||
if (ideFrame != null) {
|
||||
getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC).applicationActivated(ideFrame);
|
||||
}
|
||||
}
|
||||
else if (!activation && isActive()) {
|
||||
myActive = false;
|
||||
IdeFrame ideFrame = getIdeFrameFromWindow(window);
|
||||
if (ideFrame != null) {
|
||||
getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC).applicationDeactivated(ideFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IdeFrame getIdeFrameFromWindow(Window window) {
|
||||
Component frame = UIUtil.findUltimateParent(window);
|
||||
return frame instanceof IdeFrame ? (IdeFrame)frame : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return isUnitTestMode() || myActive;
|
||||
if (isUnitTestMode()) return true;
|
||||
|
||||
Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
|
||||
|
||||
if (ApplicationActivationStateManager.getState().isInactive()
|
||||
&& activeWindow != null) {
|
||||
ApplicationActivationStateManager.updateState(activeWindow);
|
||||
}
|
||||
|
||||
return ApplicationActivationStateManager.getState().isActive();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.components.impl.ServiceManagerImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
@@ -1070,79 +1069,35 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
|
||||
}
|
||||
|
||||
private class AppListener extends ApplicationActivationListener.Adapter {
|
||||
|
||||
@Override
|
||||
public void applicationActivated(final IdeFrame ideFrame) {
|
||||
|
||||
if (Registry.is("trace.focus.on.app.activation")) {
|
||||
LOG.info("Application is activating");
|
||||
}
|
||||
|
||||
final FocusCommand cmd = myFocusCommandOnAppActivation;
|
||||
ActionCallback callback = myCallbackOnActivation;
|
||||
myFocusCommandOnAppActivation = null;
|
||||
myCallbackOnActivation = null;
|
||||
|
||||
if (cmd != null) {
|
||||
if (Registry.is("trace.focus.on.app.activation")) {
|
||||
LOG.info("Use focus command that we have saved on deactivation");
|
||||
LOG.info(cmd.getAllocation());
|
||||
}
|
||||
requestFocus(cmd, true).notify(callback);
|
||||
} else {
|
||||
Component lastFocusedComponent = focusLastFocusedComponent(ideFrame);
|
||||
if (Registry.is("trace.focus.on.app.activation")) {
|
||||
final Project project = ideFrame.getProject();
|
||||
if (project != null) {
|
||||
LOG.info("Use last focused component because we do not have a focus command");
|
||||
LOG.info("Component in [" + project.getName() + "]: " + (lastFocusedComponent != null ? lastFocusedComponent.getClass().getName() : null));
|
||||
}
|
||||
}
|
||||
focusLastFocusedComponent(ideFrame);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applicationDeactivated(IdeFrame ideFrame) {
|
||||
public void delayedApplicationDeactivated(IdeFrame ideFrame) {
|
||||
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
Component parent = UIUtil.findUltimateParent(owner);
|
||||
|
||||
if (Registry.is("trace.focus.on.app.activation")) {
|
||||
LOG.info("Application is deactivating");
|
||||
}
|
||||
|
||||
final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
Component parent = UIUtil.findUltimateParent(owner);
|
||||
|
||||
if (parent == ideFrame) {
|
||||
myLastFocusedAtDeactivation.put(ideFrame, owner);
|
||||
if (Registry.is("trace.focus.on.app.activation")) {
|
||||
final Project project = ideFrame.getProject();
|
||||
String projectName = null;
|
||||
if (project != null) {
|
||||
projectName = project.getName();
|
||||
}
|
||||
LOG.info("The next component is set as ths last focused for [" + projectName +"]");
|
||||
if (parent == ideFrame) {
|
||||
myLastFocusedAtDeactivation.put(ideFrame, owner);
|
||||
}
|
||||
} else {
|
||||
if (Registry.is("trace.focus.on.app.activation")) {
|
||||
if (owner != null) {
|
||||
final Project project = ideFrame.getProject();
|
||||
String projectName = null;
|
||||
if (project != null) {
|
||||
projectName = project.getName();
|
||||
}
|
||||
LOG.error("The last focused component " +
|
||||
(owner != null ? owner.getClass().getName() : null) +
|
||||
" is not in the deactivating frame [" + projectName + "]. Skip it.");
|
||||
} else {
|
||||
LOG.info("The last focused component is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Component focusLastFocusedComponent(IdeFrame ideFrame) {
|
||||
private void focusLastFocusedComponent(IdeFrame ideFrame) {
|
||||
final KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
||||
Component c = null;
|
||||
if (mgr.getFocusOwner() == null) {
|
||||
c = getComponent(myLastFocusedAtDeactivation, ideFrame);
|
||||
Component c = getComponent(myLastFocusedAtDeactivation, ideFrame);
|
||||
if (c == null || !c.isShowing()) {
|
||||
c = getComponent(myLastFocusedAtDeactivation, ideFrame);
|
||||
}
|
||||
@@ -1165,7 +1120,6 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
|
||||
}
|
||||
|
||||
myLastFocusedAtDeactivation.remove(ideFrame);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+33
-37
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.openapi.wm.impl.status;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.notification.EventLog;
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
@@ -376,45 +375,42 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
|
||||
myRefreshAndInfoPanel.revalidate();
|
||||
myRefreshAndInfoPanel.repaint();
|
||||
|
||||
UISettings uiSettings = UISettings.getInstance();
|
||||
if (uiSettings.PRESENTATION_MODE || !uiSettings.SHOW_STATUS_BAR && Registry.is("ide.show.progress.without.status.bar")) {
|
||||
final JRootPane pane = myInfoPanel.getRootPane();
|
||||
assert pane != null;
|
||||
final PresentationModeProgressPanel panel = new PresentationModeProgressPanel(inline);
|
||||
final MyInlineProgressIndicator delegate = new MyInlineProgressIndicator(true, inline.getInfo(), inline) {
|
||||
@Override
|
||||
protected void updateProgress() {
|
||||
super.updateProgress();
|
||||
panel.update();
|
||||
}
|
||||
};
|
||||
final JRootPane pane = myInfoPanel.getRootPane();
|
||||
assert pane != null;
|
||||
final PresentationModeProgressPanel panel = new PresentationModeProgressPanel(inline);
|
||||
MyInlineProgressIndicator delegate = new MyInlineProgressIndicator(true, inline.getInfo(), inline) {
|
||||
@Override
|
||||
protected void updateProgress() {
|
||||
super.updateProgress();
|
||||
panel.update();
|
||||
}
|
||||
};
|
||||
|
||||
Disposer.register(inline, delegate);
|
||||
Disposer.register(inline, delegate);
|
||||
|
||||
final Component anchor = getAnchor(pane);
|
||||
Component anchor = getAnchor(pane);
|
||||
|
||||
JBPopupFactory.getInstance().createBalloonBuilder(panel.getProgressPanel())
|
||||
.setFadeoutTime(0)
|
||||
.setFillColor(Gray.TRANSPARENT)
|
||||
.setShowCallout(false)
|
||||
.setBorderColor(Gray.TRANSPARENT)
|
||||
.setBorderInsets(JBUI.emptyInsets())
|
||||
.setAnimationCycle(0)
|
||||
.setCloseButtonEnabled(false)
|
||||
.setHideOnClickOutside(false)
|
||||
.setDisposable(inline)
|
||||
.setHideOnFrameResize(false)
|
||||
.setHideOnKeyOutside(false)
|
||||
.setBlockClicksThroughBalloon(true)
|
||||
.setHideOnAction(false)
|
||||
.createBalloon().show(new PositionTracker<Balloon>(anchor) {
|
||||
@Override
|
||||
public RelativePoint recalculateLocation(Balloon object) {
|
||||
Component c = getAnchor(pane);
|
||||
return new RelativePoint(c, new Point(c.getWidth() - 150, c.getHeight() - 45));
|
||||
}
|
||||
}, Balloon.Position.above);
|
||||
}
|
||||
JBPopupFactory.getInstance().createBalloonBuilder(panel.getProgressPanel())
|
||||
.setFadeoutTime(0)
|
||||
.setFillColor(Gray.TRANSPARENT)
|
||||
.setShowCallout(false)
|
||||
.setBorderColor(Gray.TRANSPARENT)
|
||||
.setBorderInsets(JBUI.emptyInsets())
|
||||
.setAnimationCycle(0)
|
||||
.setCloseButtonEnabled(false)
|
||||
.setHideOnClickOutside(false)
|
||||
.setDisposable(inline)
|
||||
.setHideOnFrameResize(false)
|
||||
.setHideOnKeyOutside(false)
|
||||
.setBlockClicksThroughBalloon(true)
|
||||
.setHideOnAction(false)
|
||||
.createBalloon().show(new PositionTracker<Balloon>(anchor) {
|
||||
@Override
|
||||
public RelativePoint recalculateLocation(Balloon object) {
|
||||
Component c = getAnchor(pane);
|
||||
return new RelativePoint(c, new Point(c.getWidth() - 150, c.getHeight() - 45));
|
||||
}
|
||||
}, Balloon.Position.above);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+19
-2
@@ -16,13 +16,18 @@
|
||||
package com.intellij.openapi.wm.impl.status;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.ui.popup.IconButton;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.InplaceButton;
|
||||
import com.intellij.ui.TransparentPanel;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -59,6 +64,12 @@ public class PresentationModeProgressPanel {
|
||||
updateImpl();
|
||||
}
|
||||
};
|
||||
Disposer.register(progress, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
UIUtil.dispose(myCancelButton);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void update() {
|
||||
@@ -66,7 +77,7 @@ public class PresentationModeProgressPanel {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Color getTextForeground() {
|
||||
private static Color getTextForeground() {
|
||||
return EditorColorsManager.getInstance().getGlobalScheme().getDefaultForeground();
|
||||
}
|
||||
|
||||
@@ -98,7 +109,13 @@ public class PresentationModeProgressPanel {
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
myRootPanel = new TransparentPanel(0.5f);
|
||||
myRootPanel = new TransparentPanel(0.5f) {
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
UISettings ui = UISettings.getInstance();
|
||||
return ui.PRESENTATION_MODE || !ui.SHOW_STATUS_BAR && Registry.is("ide.show.progress.without.status.bar");
|
||||
}
|
||||
};
|
||||
final IconButton iconButton = new IconButton(myProgress.getInfo().getCancelTooltipText(),
|
||||
AllIcons.Process.Stop,
|
||||
AllIcons.Process.StopHovered);
|
||||
|
||||
@@ -645,6 +645,7 @@ tests.view.old.statistics.panel=false
|
||||
|
||||
tfs.set.connection.timeout=false
|
||||
|
||||
application.deactivation.timeout=1500
|
||||
ide.mac.yosemite.laf=false
|
||||
ide.mac.yosemite.laf.restartRequired=true
|
||||
ide.mac.yosemite.laf.description=Replaces Aqua LaF to enhanced IntelliJ LaF
|
||||
@@ -677,4 +678,4 @@ trace.focus.on.app.restartRequired=false
|
||||
rbenv.gemsets.enabled=false
|
||||
|
||||
editor.hide.gutter.icons=false
|
||||
editor.hide.gutter.icons.description=Hide gutter icons
|
||||
editor.hide.gutter.icons.description=Hide gutter icons
|
||||
|
||||
Regular → Executable
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
+10
@@ -17,6 +17,7 @@ package com.intellij.lang.properties.editor;
|
||||
|
||||
import com.intellij.ide.presentation.Presentation;
|
||||
import com.intellij.lang.properties.ResourceBundle;
|
||||
import com.intellij.lang.properties.ResourceBundleImpl;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -97,6 +98,15 @@ public class ResourceBundleAsVirtualFile extends VirtualFile {
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
if (myResourceBundle instanceof ResourceBundleImpl && !((ResourceBundleImpl)myResourceBundle).isValid()) {
|
||||
return false;
|
||||
}
|
||||
for (PropertiesFile propertiesFile : myResourceBundle.getPropertiesFiles()) {
|
||||
final VirtualFile virtualFile = propertiesFile.getVirtualFile();
|
||||
if (virtualFile == null || !virtualFile.isValid()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user