/*
   * (non-Javadoc)
   *
   * @see org.eclipse.ui.tests.harness.util.UITestCase#doSetUp()
   */
  protected void doSetUp() throws Exception {
    super.doSetUp();

    window = openTestWindow();
    menuService = (IMenuService) window.getService(IMenuService.class);
    contextService = (IContextService) window.getService(IContextService.class);
    Context context1 = contextService.getContext(MenuContributionHarness.CONTEXT_TEST1_ID);
    if (!context1.isDefined()) {
      context1.define("Menu Test 1", "Menu test 1", IContextService.CONTEXT_ID_DIALOG_AND_WINDOW);
    }
  }
Ejemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.ui.tests.harness.util.UITestCase#doSetUp()
   */
  protected void doSetUp() throws Exception {
    for (int i = 0; i < CREATE_CONTEXTS.length; i++) {
      final String[] contextInfo = CREATE_CONTEXTS[i];
      final Context context = contextService.getContext(contextInfo[0]);
      if (!context.isDefined()) {
        context.define(contextInfo[1], contextInfo[2], contextInfo[3]);
      }
    }

    Command cmd = commandService.getCommand(CMD_ID);
    if (!cmd.isDefined()) {
      Category cat = commandService.getCategory(CATEGORY_ID);
      cmd.define("Test Handler", "Test handler activation", cat);
    }
  }
 private void defineContexts(MBindingContext parent, MBindingContext current) {
   if (current.getName() == null || current.getElementId() == null) {
     logger.error("Binding context name or id is null for: " + current); // $NON-NLS-1$
     return;
   }
   Context context = contextManager.getContext(current.getElementId());
   if (!context.isDefined()) {
     String localizedName =
         LocalizationHelper.getLocalized(current.getName(), current, application.getContext());
     String localizedDescriptor =
         LocalizationHelper.getLocalized(
             current.getDescription(), current, application.getContext());
     context.define(
         localizedName, localizedDescriptor, parent == null ? null : parent.getElementId());
   }
   for (MBindingContext child : current.getChildren()) {
     defineContexts(current, child);
   }
 }
 private void undefineContext(MBindingContext current) {
   Context context = contextManager.getContext(current.getElementId());
   context.undefine();
 }