當前位置: 首頁>>代碼示例>>Java>>正文


Java ToolWindowAnchor類代碼示例

本文整理匯總了Java中com.intellij.openapi.wm.ToolWindowAnchor的典型用法代碼示例。如果您正苦於以下問題:Java ToolWindowAnchor類的具體用法?Java ToolWindowAnchor怎麽用?Java ToolWindowAnchor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ToolWindowAnchor類屬於com.intellij.openapi.wm包,在下文中一共展示了ToolWindowAnchor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TelemetryToolWindow

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
private TelemetryToolWindow(Project project) {
    ToolWindowManager manager = ToolWindowManager.getInstance(project);

    if (window == null) {
        textPane = new JTextPane();
        textPane.setEditable(false);

        JBScrollPane scrollPane = new JBScrollPane(textPane);
        DefaultCaret caret = (DefaultCaret) textPane.getCaret();
        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

        textPane.setContentType("text/html");
        initHtmlComposer();

        window = manager.registerToolWindow(WINDOW_ID, scrollPane, ToolWindowAnchor.BOTTOM);
        window.show(EMPTY_TASK);
    }
}
 
開發者ID:andreyfomenkov,項目名稱:green-cat,代碼行數:19,代碼來源:TelemetryToolWindow.java

示例2: actionPerformed

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent event)
{
    project = event.getProject();
    if (project == null)
    {
        return;
    }
    ToolWindowManager toolWindowMgr = ToolWindowManager.getInstance(project);
    ToolWindow tw = toolWindowMgr.getToolWindow(TOOL_WINDOW_ID);
    if (tw == null)
    {
        tw = toolWindowMgr.registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.BOTTOM, true);
    }
    final ToolWindow toolWindow = tw;
    toolWindow.activate(() -> updateContent(toolWindow, project.getName()), true);
}
 
開發者ID:miche-atucha,項目名稱:deps-checker,代碼行數:18,代碼來源:CheckVersionAction.java

示例3: showTestResultsToolWindow

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
public static void showTestResultsToolWindow(@NotNull final Project project, @NotNull final String message) {
  ApplicationManager.getApplication().invokeLater(() -> {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
    if (window == null) {
      toolWindowManager.registerToolWindow(StudyTestResultsToolWindowFactoryKt.ID, true, ToolWindowAnchor.BOTTOM);
      window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
      new StudyTestResultsToolWindowFactory().createToolWindowContent(project, window);
    }

    final Content[] contents = window.getContentManager().getContents();
    for (Content content : contents) {
      final JComponent component = content.getComponent();
      if (component instanceof ConsoleViewImpl) {
        ((ConsoleViewImpl)component).clear();
        ((ConsoleViewImpl)component).print(message, ConsoleViewContentType.ERROR_OUTPUT);
        window.setAvailable(true,null);
        window.show(null);
      }
    }
  });
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:23,代碼來源:StudyCheckUtils.java

示例4: initFacet

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
@Override
public void initFacet() {

    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            ToolWindowManager manager = ToolWindowManager.getInstance(MuleFacet.this.getModule().getProject());
            List<String> ids = Arrays.asList(manager.getToolWindowIds());

            if (manager.getToolWindow("Global Configs") == null && !ids.contains("Global Configs")) {

                try {
                    ToolWindow toolWindow = manager.registerToolWindow("Global Configs", true, ToolWindowAnchor.LEFT, false);
                    toolWindow.setIcon(MuleIcons.MuleIcon);

                    GlobalConfigsToolWindowPanel toolWindowPanel = new GlobalConfigsToolWindowPanel(MuleFacet.this.getModule().getProject());
                    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
                    Content content = contentFactory.createContent(toolWindowPanel, "", true);
                    toolWindow.getContentManager().addContent(content);
                } catch (Exception e) {
                    logger.error("Unable to initialize toolWindow: ", e);
                }
            }
        }
    });
}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:27,代碼來源:MuleFacet.java

示例5: createWindow

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
public void createWindow(Project project) {
    jFXPanel = new JFXPanel();
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow("Basis.js", false, ToolWindowAnchor.BOTTOM, false);
    toolWindow.setIcon(IconLoader.getIcon("/icons/basisjs.png"));
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    Content content = contentFactory.createContent(jFXPanel, "inspector", false);
    toolWindow.getContentManager().addContent(content);

    InspectorController sceneInspectorController = new InspectorController();
    FXMLLoader fxmlLoader = new FXMLLoader();
    fxmlLoader.setLocation(getClass().getResource("/com/basisjs/ui/windows/tools/inspector/InspectorScene.fxml"));
    fxmlLoader.setController(sceneInspectorController);

    Platform.setImplicitExit(false);
    PlatformImpl.runLater(() -> {
        try {
            Scene scene = new Scene(fxmlLoader.load());
            jFXPanel.setScene(scene);
            webView = sceneInspectorController.webView;
            webView.setContextMenuEnabled(false);
        } catch (IOException e) {
            e.printStackTrace();
        }
    });
}
 
開發者ID:smelukov,項目名稱:intellij-basisjs-plugin,代碼行數:26,代碼來源:InspectorWindow.java

示例6: createConsole

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
private void createConsole(@NotNull final NetService netService) {
  TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject());
  netService.configureConsole(consoleBuilder);
  console = consoleBuilder.getConsole();

  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      ActionGroup actionGroup = netService.getConsoleToolWindowActions();
      ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);

      SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
      toolWindowPanel.setContent(console.getComponent());
      toolWindowPanel.setToolbar(toolbar.getComponent());

      ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject())
        .registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true);
      toolWindow.setIcon(netService.getConsoleToolWindowIcon());

      Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, "", false);
      Disposer.register(content, console);

      toolWindow.getContentManager().addContent(content);
    }
  }, netService.getProject().getDisposed());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:ConsoleManager.java

示例7: setupImpl

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
public static void setupImpl(@NotNull Project project, boolean loadPaneExtensions) {
  ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
  ToolWindow toolWindow = toolWindowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);

  if (toolWindow == null) {
    ToolWindowEP[] beans = Extensions.getExtensions(ToolWindowEP.EP_NAME);
    for (final ToolWindowEP bean : beans) {
      if (bean.id.equals(ToolWindowId.PROJECT_VIEW)) {
        toolWindow = toolWindowManager.registerToolWindow(bean.id, new JLabel(), ToolWindowAnchor.fromText(bean.anchor), project,
                                                          false, bean.canCloseContents);
        break;
      }
    }
  }

  ((ProjectViewImpl)ProjectView.getInstance(project)).setupImpl(toolWindow, loadPaneExtensions);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:ProjectViewTestUtil.java

示例8: getBorderInsets

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
@Override
public Insets getBorderInsets(Component c) {
  Stripe stripe = (Stripe)c;
  ToolWindowAnchor anchor = stripe.getAnchor();

  Insets result = new Insets(0, 0, 0, 0);
  final int off = UIUtil.isUnderDarcula() ? 1 : 0;
  if (anchor == ToolWindowAnchor.LEFT) {
    result.top = 1;
    result.right = 1 + off;
  }
  else if (anchor == ToolWindowAnchor.RIGHT) {
    result.left = 1 + off;
    result.top = 1;
  }
  else if (anchor == ToolWindowAnchor.TOP) {
    result.bottom = 0;
    //result.bottom = 1;
    result.top = 1;
  }
  else {
    result.top = 1 + off;
  }

  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:Stripe.java

示例9: paintComponent

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
@Override
protected void paintComponent(final Graphics g) {
  super.paintComponent(g);
  if (!myFinishingDrop && isDroppingButton() && myDragButton.getParent() != this) {
    g.setColor(getBackground().brighter());
    g.fillRect(0, 0, getWidth(), getHeight());
  }
  if (UIUtil.isUnderDarcula()) return;
  ToolWindowAnchor anchor = getAnchor();
  g.setColor(new Color(255, 255, 255, 40));
  Rectangle r = getBounds();
  if (anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT) {
    g.drawLine(0, 0, 0, r.height);
    g.drawLine(r.width - 2, 0, r.width - 2, r.height);
  }
  else {
    g.drawLine(0, 1, r.width, 1);
    g.drawLine(0, r.height - 1, r.width, r.height - 1);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:Stripe.java

示例10: setComponent

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
/**
 * Sets (docks) specified component to the specified anchor.
 */
private void setComponent(final JComponent component, final ToolWindowAnchor anchor, final float weight) {
  if (ToolWindowAnchor.TOP == anchor) {
    myVerticalSplitter.setFirstComponent(component);
    myVerticalSplitter.setFirstSize((int)(myLayeredPane.getHeight() * weight));
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    myHorizontalSplitter.setFirstComponent(component);
    myHorizontalSplitter.setFirstSize((int)(myLayeredPane.getWidth() * weight));
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    myVerticalSplitter.setLastComponent(component);
    myVerticalSplitter.setLastSize((int)(myLayeredPane.getHeight() * weight));
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    myHorizontalSplitter.setLastComponent(component);
    myHorizontalSplitter.setLastSize((int)(myLayeredPane.getWidth() * weight));
  }
  else {
    LOG.error("unknown anchor: " + anchor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:ToolWindowsPane.java

示例11: getToolWindow

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
public ToolWindow getToolWindow() {
  if (myToolWindow == null) {
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(GroovyBundle.message("dynamic.tool.window.id"), true, ToolWindowAnchor.RIGHT);
    myToolWindow.setIcon(JetgroovyIcons.Groovy.DynamicProperty_13);
    myToolWindow.setTitle(GroovyBundle.message("dynamic.window"));
    myToolWindow.setToHideOnEmptyContent(true);

    final JPanel panel = buildBigPanel();
    final ContentManager contentManager = myToolWindow.getContentManager();
    final Content content = contentManager.getFactory().createContent(panel, "", false);
    content.setPreferredFocusableComponent(myTreeTable);
    contentManager.addContent(content);
  }

  return myToolWindow;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:DynamicToolWindowWrapper.java

示例12: getStripeFor

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
@Nullable
Stripe getStripeFor(String id) {
  ToolWindow window = myManager.getToolWindow(id);
  if (window == null) {
    return null;
  }

  final ToolWindowAnchor anchor = myManager.getToolWindow(id).getAnchor();
  if (ToolWindowAnchor.TOP == anchor) {
    return myTopStripe;
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    return myBottomStripe;
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    return myLeftStripe;
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    return myRightStripe;
  }

  throw new IllegalArgumentException("Anchor=" + anchor);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ToolWindowsPane.java

示例13: run

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
public final void run() {
  try {
    final ToolWindowAnchor anchor = myInfo.getAnchor();
    if (ToolWindowAnchor.TOP == anchor) {
      myTopStripe.addButton(myButton, myComparator);
    }
    else if (ToolWindowAnchor.LEFT == anchor) {
      myLeftStripe.addButton(myButton, myComparator);
    }
    else if (ToolWindowAnchor.BOTTOM == anchor) {
      myBottomStripe.addButton(myButton, myComparator);
    }
    else if (ToolWindowAnchor.RIGHT == anchor) {
      myRightStripe.addButton(myButton, myComparator);
    }
    else {
      LOG.error("unknown anchor: " + anchor);
    }
    validate();
    repaint();
  }
  finally {
    finish();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:ToolWindowsPane.java

示例14: setBoundsInPaletteLayer

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
public final void setBoundsInPaletteLayer(final Component component, final ToolWindowAnchor anchor, float weight) {
  if (weight < .0f) {
    weight = WindowInfoImpl.DEFAULT_WEIGHT;
  }
  else if (weight > 1.0f) {
    weight = 1.0f;
  }
  if (ToolWindowAnchor.TOP == anchor) {
    component.setBounds(0, 0, getWidth(), (int)(getHeight() * weight + .5f));
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    component.setBounds(0, 0, (int)(getWidth() * weight + .5f), getHeight());
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    final int height = (int)(getHeight() * weight + .5f);
    component.setBounds(0, getHeight() - height, getWidth(), height);
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    final int width = (int)(getWidth() * weight + .5f);
    component.setBounds(getWidth() - width, 0, width, getHeight());
  }
  else {
    LOG.error("unknown anchor " + anchor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:ToolWindowsPane.java

示例15: register

import com.intellij.openapi.wm.ToolWindowAnchor; //導入依賴的package包/類
/**
 * Creates or gets <code>WindowInfo</code> for the specified <code>id</code>. If tool
 * window is being registered first time the method uses <code>anchor</code>.
 *
 * @param id     <code>id</code> of tool window to be registered.
 * @param anchor the default tool window anchor.
 */
final WindowInfoImpl register(@NotNull String id, @NotNull ToolWindowAnchor anchor, final boolean splitMode) {
  WindowInfoImpl info = myUnregisteredId2Info.get(id);
  if (info != null) { // tool window has been already registered some time
    myUnregisteredId2Info.remove(id);
  }
  else { // tool window is being registered first time
    info = new WindowInfoImpl(id);
    info.setAnchor(anchor);
    info.setSplit(splitMode);
  }
  myRegisteredId2Info.put(id, info);
  // invalidate caches
  myRegisteredInfos = null;
  myUnregisteredInfos = null;
  myAllInfos = null;
  //
  return info;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:DesktopLayout.java


注:本文中的com.intellij.openapi.wm.ToolWindowAnchor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。