Java Code Examples for com.intellij.openapi.wm.ToolWindow#setAvailable()

The following examples show how to use com.intellij.openapi.wm.ToolWindow#setAvailable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ORToolWindowManager.java    From reasonml-idea-plugin with MIT License 6 votes vote down vote up
public void showHideToolWindows() {
    ToolWindow bsToolWindow = m_toolWindowProvider.getBsToolWindow();
    if (bsToolWindow != null) {
        bsToolWindow.setAvailable(shouldShowBsToolWindow(m_project), null);
    }

    ToolWindow duneToolWindow = m_toolWindowProvider.getDuneToolWindow();
    if (duneToolWindow != null) {
        duneToolWindow.setAvailable(shouldShowDuneToolWindow(m_project), null);
    }

    ToolWindow esyToolWindow = m_toolWindowProvider.getEsyToolWindow();
    if (esyToolWindow != null) {
        esyToolWindow.setAvailable(shouldShowEsyToolWindow(m_project), null);
    }
}
 
Example 2
Source File: BuckToolWindowFactory.java    From Buck-IntelliJ-Plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void createToolWindowContent(
    @NotNull final Project project, @NotNull ToolWindow toolWindow) {
  toolWindow.setAvailable(true, null);
  toolWindow.setToHideOnEmptyContent(true);

  RunnerLayoutUi runnerLayoutUi = BuckUIManager.getInstance(project).getLayoutUi(project);
  Content consoleContent = createConsoleContent(runnerLayoutUi, project);

  runnerLayoutUi.addContent(consoleContent, 0, PlaceInGrid.center, false);
  runnerLayoutUi.getOptions().setLeftToolbar(
      getLeftToolbarActions(project), ActionPlaces.UNKNOWN);

  runnerLayoutUi.updateActionsNow();

  final ContentManager contentManager = toolWindow.getContentManager();
  Content content = contentManager.getFactory().createContent(
      runnerLayoutUi.getComponent(), "", true);
  contentManager.addContent(content);

  updateBuckToolWindowTitle(project);
}
 
Example 3
Source File: YiiStormSettingsPage.java    From yiistorm with MIT License 6 votes vote down vote up
@Override
public void apply() throws ConfigurationException {
    PropertiesComponent properties = PropertiesComponent.getInstance(project);
    properties.setValue("enableYiiStorm", String.valueOf(enableYiiStorm.isSelected()));
    properties.setValue("themeName", themeNameField.getText());
    properties.setValue("langName", langField.getText());
    properties.setValue("yiicFile", yiicFileField.getText());
    // properties.setValue("yiiConfigPath", yiiConfigPath.getText());
    // properties.setValue("yiiLitePath", yiiLitePath.getText());
    // properties.setValue("useYiiCompleter", String.valueOf(useYiiCompleter.isSelected()));
    // properties.setValue("useYiiMigrations", String.valueOf(useMigrationsCheckbox.isSelected()));

    final ToolWindowManager manager = ToolWindowManager.getInstance(project);
    final ToolWindow tw = manager.getToolWindow("Migrations");
    if (tw != null) {
        tw.setAvailable(MigrationsCondition.makeCondition(project), null);
    }
   /* if (properties.getBoolean("useYiiCompleter", false)) {
        YiiStormProjectComponent.getInstance(project).loadConfigParser();
    } else {
        YiiStormProjectComponent.getInstance(project).clearConfigParser();
    } */

}
 
Example 4
Source File: BuckToolWindowFactory.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
  toolWindow.setAvailable(true, null);
  toolWindow.setToHideOnEmptyContent(true);
  toolWindow.setIcon(BuckIcons.BUCK_TOOL_WINDOW_ICON);

  BuckProjectSettingsProvider settingsProvider = BuckProjectSettingsProvider.getInstance(project);
  BuckUIManager buckUIManager = BuckUIManager.getInstance(project);

  // Init tool window
  buckUIManager.initBuckToolWindow(settingsProvider.isShowDebugWindow());
}
 
Example 5
Source File: ServersToolWindowManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void updateWindowAvailable(boolean showIfAvailable) {
  ToolWindow toolWindow = myToolWindowManager.getToolWindow(ID);

  boolean available = isAvailable();
  boolean doShow = !toolWindow.isAvailable() && available;
  if (toolWindow.isAvailable() && !available) {
    toolWindow.hide(null);
  }
  toolWindow.setAvailable(available, null);
  if (showIfAvailable && doShow) {
    toolWindow.show(null);
  }
}
 
Example 6
Source File: ProblemsView.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void showCurrentFileProblems(@Nonnull Project project) {
  ToolWindow window = getToolWindow(project);
  if (window == null) return; // does not exist
  selectContent(window.getContentManager(), 0);
  window.setAvailable(true, null);
  window.activate(null, true);
}
 
Example 7
Source File: LogviewFactory.java    From logviewer with Apache License 2.0 4 votes vote down vote up
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {

    final File adb = AndroidSdkUtils.getAdb(project);
    ExecutionManager.getInstance(project).getContentManager();

    RunnerLayoutUi layoutUi = RunnerLayoutUi.Factory.getInstance(project).create("LogViewer", TOOL_WINDOW_ID, "Logview Tools", project);

    toolWindow.setIcon(LogviewerPluginIcons.TOOL_ICON);
    toolWindow.setAvailable(true, null);
    toolWindow.setToHideOnEmptyContent(true);
    toolWindow.setTitle(TOOL_WINDOW_ID);


    DeviceContext deviceContext = new DeviceContext();

    Content logcatContent = createLogcatContent(layoutUi, project, deviceContext);
    final LogView logcatView = logcatContent.getUserData(LOG_VIEW_KEY);
    layoutUi.addContent(logcatContent, 0, PlaceInGrid.center, false);

    final JBLoadingPanel loadingPanel = new JBLoadingPanel(new BorderLayout(), project);
    loadingPanel.add(layoutUi.getComponent(), BorderLayout.CENTER);

    final ContentManager contentManager = toolWindow.getContentManager();
    Content c = contentManager.getFactory().createContent(loadingPanel, "", true);
    c.putUserData(LOG_VIEW_KEY, logcatView);
    contentManager.addContent(c);
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            logcatView.activate();
        }
    }, project.getDisposed());


    if (adb != null) {
        loadingPanel.setLoadingText("Initializing ADB");
        loadingPanel.startLoading();

        //ListenableFuture<AndroidDebugBridge> future = AdbService.getInstance().getDebugBridge(adb);
        ListenableFuture<AndroidDebugBridge> future = AdbBridgeFactory.getAdb(adb);
        Futures.addCallback(future, new FutureCallback<AndroidDebugBridge>() {
            @Override
            public void onSuccess(@Nullable AndroidDebugBridge bridge) {
                Logger.getInstance(LogviewFactory.class).info("Successfully obtained debug bridge");
                loadingPanel.stopLoading();
            }

            @Override
            public void onFailure(@NotNull Throwable t) {
                loadingPanel.stopLoading();
                Logger.getInstance(LogviewFactory.class).info("Unable to obtain debug bridge", t);
                String msg;
                if (t.getMessage() != null) {
                    msg = t.getMessage();
                } else {
                    msg = String.format("Unable to establish a connection to adb",
                            ApplicationNamesInfo.getInstance().getProductName(), adb.getAbsolutePath());
                }
                Messages.showErrorDialog(msg, "ADB Connection Error");
            }
        }, EdtExecutor.INSTANCE);
    } else {
        logcatView.showHint("No adb connection!.\n\nDrag and drop log files to view them.");
    }
}
 
Example 8
Source File: FlutterViewFactory.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void init(ToolWindow window) {
  window.setAvailable(true, null);
}
 
Example 9
Source File: FlutterPerformanceViewFactory.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void init(ToolWindow window) {
  window.setAvailable(true, null);
}
 
Example 10
Source File: FlutterPerformanceView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
void debugActive(@NotNull FlutterViewMessages.FlutterDebugEvent event) {
  final FlutterApp app = event.app;
  final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
  if (!(toolWindowManager instanceof ToolWindowManagerEx)) {
    return;
  }

  final ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID);
  if (toolWindow == null) {
    return;
  }

  if (!toolWindow.isAvailable()) {
    toolWindow.setAvailable(true, null);
  }

  addPerformanceViewContent(app, toolWindow);

  app.getVmService().addVmServiceListener(new VmServiceListenerAdapter() {
    @Override
    public void connectionOpened() {
      onAppChanged(app);
    }

    @Override
    public void connectionClosed() {
      ApplicationManager.getApplication().invokeLater(() -> {
        if (toolWindow.isDisposed()) return;
        final ContentManager contentManager = toolWindow.getContentManager();
        onAppChanged(app);
        final PerfViewAppState state = perAppViewState.remove(app);
        if (state != null) {
          if (state.content != null) {
            contentManager.removeContent(state.content, true);
          }
          if (state.disposable != null) {
            Disposer.dispose(state.disposable);
          }
        }
        if (perAppViewState.isEmpty()) {
          // No more applications are running.
          updateForEmptyContent(toolWindow);
        }
      });
    }
  });
  onAppChanged(app);
}
 
Example 11
Source File: FlutterViewFactory.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void init(ToolWindow window) {
  window.setAvailable(true, null);
}
 
Example 12
Source File: FlutterPerformanceViewFactory.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void init(ToolWindow window) {
  window.setAvailable(true, null);
}
 
Example 13
Source File: FlutterPerformanceView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
void debugActive(@NotNull FlutterViewMessages.FlutterDebugEvent event) {
  final FlutterApp app = event.app;
  final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
  if (!(toolWindowManager instanceof ToolWindowManagerEx)) {
    return;
  }

  final ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID);
  if (toolWindow == null) {
    return;
  }

  if (!toolWindow.isAvailable()) {
    toolWindow.setAvailable(true, null);
  }

  addPerformanceViewContent(app, toolWindow);

  app.getVmService().addVmServiceListener(new VmServiceListenerAdapter() {
    @Override
    public void connectionOpened() {
      onAppChanged(app);
    }

    @Override
    public void connectionClosed() {
      ApplicationManager.getApplication().invokeLater(() -> {
        if (toolWindow.isDisposed()) return;
        final ContentManager contentManager = toolWindow.getContentManager();
        onAppChanged(app);
        final PerfViewAppState state = perAppViewState.remove(app);
        if (state != null) {
          if (state.content != null) {
            contentManager.removeContent(state.content, true);
          }
          if (state.disposable != null) {
            Disposer.dispose(state.disposable);
          }
        }
        if (perAppViewState.isEmpty()) {
          // No more applications are running.
          updateForEmptyContent(toolWindow);
        }
      });
    }
  });
  onAppChanged(app);
}