Exemplo n.º 1
0
  public void testPropertyChange() throws Exception {
    IWorkbenchWindow window = openTestWindow();
    IEvaluationService service = (IEvaluationService) window.getService(IEvaluationService.class);
    assertNotNull(service);
    MyEval listener = new MyEval();
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IConfigurationElement element = null;
    IConfigurationElement[] elements =
        registry.getConfigurationElementsFor("org.eclipse.core.expressions.definitions");
    for (int i = 0; i < elements.length && element == null; i++) {
      if (elements[i].getAttribute("id").equals("org.eclipse.ui.tests.defWithPropertyTester")) {
        element = elements[i];
      }
    }

    assertNotNull(element);
    Expression expr = ExpressionConverter.getDefault().perform(element.getChildren()[0]);
    service.addEvaluationListener(expr, listener, IEvaluationService.RESULT);
    assertFalse(listener.currentValue);
    assertEquals(1, listener.count);

    StaticVarPropertyTester.result = true;
    assertFalse(listener.currentValue);
    assertEquals(1, listener.count);

    service.requestEvaluation("org.eclipse.ui.tests.class.method");
    assertTrue(listener.currentValue);
    assertEquals(2, listener.count);

    service.requestEvaluation("org.eclipse.ui.tests.class.method");
    assertTrue(listener.currentValue);
    assertEquals(2, listener.count);
  }
 protected void requestRefresh() {
   IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   IEvaluationService evaluationService =
       (IEvaluationService) window.getService(IEvaluationService.class);
   if (evaluationService != null) {
     evaluationService.requestEvaluation("eu.fittest.eclipse.transformtools.members_extension");
   }
 }
Exemplo n.º 3
0
 /**
  * 刷新 Command 的可用状态
  *
  * @param nameSpace
  * @param properties ;
  */
 public static void refreshCommand(String nameSpace, String properties) {
   if (nameSpace != null && properties != null) {
     IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
     IEvaluationService evaluationService =
         (IEvaluationService) window.getService(IEvaluationService.class);
     if (evaluationService != null) {
       evaluationService.requestEvaluation(nameSpace + "." + properties);
     }
   }
 }
  @Override
  public boolean performOk() {
    if (this.enableAutoCheckin.getBooleanValue()) {
      if (isEmpty(this.currentValueOfRepoName) /*|| isEmpty(this.currentValueOfRepoBaseLocation)*/
          || isEmpty(this.currentValueOfUserName)
          || isEmpty(this.currentValueOfPassWord)) {
        MessageDialog.openWarning(
            getShell(),
            "Warning",
            "Please enter value to Repository Name,UserName and Password fields.");
        return false;
      }
      /*final String prj = this.preferenceStore.getString(P_REPOSITORY_PROJECT);
      if (isEmpty(prj)) {
      	if (!resetProjectName()) {
      		return false;
      	}
      } else {
      	if (!this.preferenceStore.getString(P_REPOSITORY_URL).equals(this.currentValueOfRepoUrl)) {
      		if (!resetProjectName()) {
      			return false;
      		}
      	}
      }*/
    }

    final boolean status = super.performOk();
    final IEvaluationService service =
        (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class);
    service.requestEvaluation("org.fastcode.menus.versioncontrol");
    if (status) {
      /*MessageDialog.openInformation(new Shell(), "Information",
      "The SVN url is specific to the project. While working with other project(s), please change the URL.");*/
      VersionControlPreferences.setReload(status);
    } else {
      return status;
    }
    return status;
  }