コード例 #1
0
ファイル: Editor.java プロジェクト: cwi-swat/pdb.ui
  public static void open(final IValue value) {
    if (value == null) {
      return;
    }
    IWorkbench wb = PlatformUI.getWorkbench();
    IWorkbenchWindow win = wb.getActiveWorkbenchWindow();

    if (win == null && wb.getWorkbenchWindowCount() != 0) {
      win = wb.getWorkbenchWindows()[0];
    }

    if (win != null) {
      final IWorkbenchPage page = win.getActivePage();

      if (page != null) {
        Display.getDefault()
            .asyncExec(
                new Runnable() {
                  public void run() {
                    try {
                      page.openEditor(new ValueEditorInput(value, true, 2), Editor.EditorId);
                    } catch (PartInitException e) {
                      PDBUIPlugin.getDefault().logException("failed to open tree editor", e);
                    }
                  }
                });
      }
    }
  }