コード例 #1
0
  /**
   * Opens the introduction componenet.
   *
   * <p>Clients must not call this method directly (although super calls are okay). The default
   * implementation opens the intro in the first window provided if the preference
   * IWorkbenchPreferences.SHOW_INTRO is <code>true</code>. If an intro is shown then this
   * preference will be set to <code>false</code>. Subsequently, and intro will be shown only if
   * <code>WorkbenchConfigurer.getSaveAndRestore()</code> returns <code>true</code> and the
   * introduction was visible on last shutdown. Subclasses may override.
   */
  public void openIntro() {
    // TODO: Refactor this into an IIntroManager.openIntro(IWorkbenchWindow) call

    // introOpened flag needs to be global
    IWorkbenchConfigurer wbConfig = getWindowConfigurer().getWorkbenchConfigurer();
    final String key = "introOpened"; // $NON-NLS-1$
    Boolean introOpened = (Boolean) wbConfig.getData(key);
    if (introOpened != null && introOpened.booleanValue()) {
      return;
    }

    wbConfig.setData(key, Boolean.TRUE);

    boolean showIntro =
        PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_INTRO);

    IIntroManager introManager = wbConfig.getWorkbench().getIntroManager();

    boolean hasIntro = introManager.hasIntro();
    boolean isNewIntroContentAvailable = introManager.isNewContentAvailable();

    if (hasIntro && (showIntro || isNewIntroContentAvailable)) {
      PrefUtil.getAPIPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false);
      PrefUtil.saveAPIPrefs();

      introManager.showIntro(getWindowConfigurer().getWindow(), false);
    }
  }
コード例 #2
0
ファイル: AbstractBuilderTest.java プロジェクト: NiciaB/xtext
  @Before
  public void setUp() throws Exception {
    assertEquals(0, countResourcesInIndex());
    assertEquals(0, root().getProjects().length);
    if (PlatformUI.isWorkbenchRunning()) {
      final IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
      if (introManager.getIntro() != null) {
        Display.getDefault()
            .asyncExec(
                new Runnable() {

                  public void run() {
                    introManager.closeIntro(introManager.getIntro());
                  }
                });
      }
    }
  }