当前位置: 首页>>代码示例>>Java>>正文


Java IdeFrameImpl.getActiveFrame方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TogglePresentationModeAction.java

示例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);
}
 
开发者ID:Shaked,项目名称:phpstorm-phpfmt,代码行数:5,代码来源:Documents.java

示例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();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:48,代码来源:RequestFocusInEditorComponentCmd.java

示例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);
    }
  }
 
开发者ID:consulo,项目名称:consulo,代码行数:57,代码来源:TipUIUtil.java


注:本文中的com.intellij.openapi.wm.impl.IdeFrameImpl.getActiveFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。