本文整理汇总了Java中com.intellij.openapi.wm.impl.IdeFrameImpl.getActiveFrame方法的典型用法代码示例。如果您正苦于以下问题:Java IdeFrameImpl.getActiveFrame方法的具体用法?Java IdeFrameImpl.getActiveFrame怎么用?Java IdeFrameImpl.getActiveFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.wm.impl.IdeFrameImpl
的用法示例。
在下文中一共展示了IdeFrameImpl.getActiveFrame方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tweakFrameFullScreen
import com.intellij.openapi.wm.impl.IdeFrameImpl; //导入方法依赖的package包/类
private static ActionCallback tweakFrameFullScreen(Project project, boolean inPresentation) {
Window window = IdeFrameImpl.getActiveFrame();
if (window instanceof IdeFrameImpl) {
IdeFrameImpl frame = (IdeFrameImpl)window;
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project);
if (inPresentation) {
propertiesComponent.setValue("full.screen.before.presentation.mode", String.valueOf(frame.isInFullScreen()));
return frame.toggleFullScreen(true);
}
else {
if (frame.isInFullScreen()) {
final String value = propertiesComponent.getValue("full.screen.before.presentation.mode");
return frame.toggleFullScreen("true".equalsIgnoreCase(value));
}
}
}
return ActionCallback.DONE;
}
示例2: isDocumentActive
import com.intellij.openapi.wm.impl.IdeFrameImpl; //导入方法依赖的package包/类
public static boolean isDocumentActive(@NotNull Document document) {
final IdeFrame activeFrame = (IdeFrame) IdeFrameImpl.getActiveFrame();
return activeFrame != null && activeFrame.getProject() != null && isDocumentActive(activeFrame.getProject(), document);
}
示例3: run
import com.intellij.openapi.wm.impl.IdeFrameImpl; //导入方法依赖的package包/类
@Override
public final void run(){
try{
final Window owner = myComponent != null ? SwingUtilities.getWindowAncestor(myComponent) : null;
if(owner==null){
myDoneCallback.setRejected();
return;
}
final Window activeFrame = IdeFrameImpl.getActiveFrame();
if (activeFrame != null && owner instanceof IdeFrameImpl && activeFrame != owner) {
myDoneCallback.setRejected();
return;
}
if(myComponent != null){
final boolean forced = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == null;
myFocusManager.requestFocus(myComponent, myForced || forced).notifyWhenDone(myDoneCallback).doWhenDone(new Runnable() {
@Override
public void run() {
if (SystemInfo.isLinux && Registry.is("suppress.focus.stealing")) return;
// if owner is active window or it has active child window which isn't floating decorator then
// don't bring owner window to font. If we will make toFront every time then it's possible
// the following situation:
// 1. user perform refactoring
// 2. "Do not show preview" dialog is popping up.
// 3. At that time "preview" tool window is being activated and modal "don't show..." dialog
// isn't active.
if(!owner.isActive()){
final Window activeWindow=getActiveWindow(owner.getOwnedWindows());
if(activeWindow == null || (activeWindow instanceof ToolWindowFloatingDecorator)){
//Thread.dumpStack();
//System.out.println("------------------------------------------------------");
owner.toFront();
}
}
}
});
} else {
myDoneCallback.setRejected();
}
}finally{
finish();
}
}
示例4: updateImages
import com.intellij.openapi.wm.impl.IdeFrameImpl; //导入方法依赖的package包/类
private static void updateImages(StringBuilder text, ClassLoader tipLoader, JEditorPane browser) {
final boolean dark = UIUtil.isUnderDarcula();
// if (!dark && !retina) {
// return;
// }
Component af = IdeFrameImpl.getActiveFrame();
Component comp = af != null ? af : browser;
int index = text.indexOf("<img", 0);
while (index != -1) {
final int end = text.indexOf(">", index + 1);
if (end == -1) return;
final String img = text.substring(index, end + 1).replace('\r', ' ').replace('\n', ' ');
final int srcIndex = img.indexOf("src=");
final int endIndex = img.indexOf(".png", srcIndex);
if (endIndex != -1) {
String path = img.substring(srcIndex + 5, endIndex);
if (!path.endsWith("_dark") && !path.endsWith("@2x")) {
boolean hidpi = JBUI.isPixHiDPI(comp);
path += (hidpi ? "@2x" : "") + (dark ? "_dark" : "") + ".png";
URL url = ResourceUtil.getResource(tipLoader, "/tips/", path);
if (url != null) {
String newImgTag = "<img src=\"" + path + "\" ";
try {
BufferedImage image = ImageIO.read(url.openStream());
int w = image.getWidth();
int h = image.getHeight();
if (UIUtil.isJreHiDPI(comp)) {
// compensate JRE scale
float sysScale = JBUI.sysScale(comp);
w = (int)(w / sysScale);
h = (int)(h / sysScale);
}
else {
// compensate image scale
float imgScale = hidpi ? 2f : 1f;
w = (int)(w / imgScale);
h = (int)(h / imgScale);
}
// fit the user scale
w = (int)(JBUI.scale((float)w));
h = (int)(JBUI.scale((float)h));
newImgTag += "width=\"" + w + "\" height=\"" + h + "\"";
}
catch (Exception ignore) {
newImgTag += "width=\"400\" height=\"200\"";
}
newImgTag += "/>";
text.replace(index, end + 1, newImgTag);
}
}
}
index = text.indexOf("<img", index + 1);
}
}