Java 类org.eclipse.core.runtime.AssertionFailedException 实例源码

项目:dsl-devkit    文件:CoreSwtbotTools.java   
/**
 * Switching to the default Avaloq perspective and resets it.
 */
public static void switchAndResetPerspective() {
  PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

    @Override
    public void run() {
      final IWorkbench workbench = PlatformUI.getWorkbench();
      final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
      IWorkbenchPage page = null;
      try {
        page = workbench.showPerspective("com.avaloq.ice.perspectives.Development", window);
      } catch (final WorkbenchException exception) {
        // Try customer perspective
        try {
          page = workbench.showPerspective("com.avaloq.ice.perspectives.Development", window);
        } catch (final WorkbenchException second) {
          // Both perspectives are missing
          throw new AssertionFailedException("Could not switch to Avaloq Perspective: " + exception.getLocalizedMessage());
        }
      }
      if (page != null) {
        page.resetPerspective();
      }
    }
  });
}
项目:che    文件:RefactoringManager.java   
/**
 * Apply linked mode rename refactoring.
 *
 * @param apply contains new element name
 * @return refactoring result
 * @throws RefactoringException when refactoring session not found.
 * @throws CoreException when impossible to apply rename refactoring
 */
public RefactoringResult applyLinkedRename(LinkedRenameRefactoringApply apply)
    throws RefactoringException, CoreException {
  RefactoringSession session = getRefactoringSession(apply.getSessionId());
  if (session instanceof RenameLinkedModeRefactoringSession) {
    RenameLinkedModeRefactoringSession renameSession =
        (RenameLinkedModeRefactoringSession) session;
    try {
      RefactoringResult refactoringResult = renameSession.doRename(apply.getNewName());
      deleteRefactoringSession(apply.getSessionId());
      return refactoringResult;
    } catch (InvocationTargetException | InterruptedException | AssertionFailedException e) {
      LOG.error(e.getMessage(), e);
      return DtoConverter.toRefactoringResultDto(
          org.eclipse.ltk.core.refactoring.RefactoringStatus.createFatalErrorStatus(
              e.getMessage()));
    }
  }

  throw new RefactoringException("There is no RenameLinkedModeRefactoringSession.");
}
项目:LibertyEiffel-Eclipse-Plugin    文件:LEProjectSupportTest.java   
private void assertCreateProjectWithBadNameArg(String name) {
    URI location = null;
    try {
        LEProjectSupport.createProject(name, location);
        Assert.fail("The call to LEProjectSupport.createProject() did not fail");
    } catch (AssertionFailedException e) {
        // TODO: handle exception
    }
}
项目:dsl-devkit    文件:CoreSwtbotTools.java   
/**
 * Open view.
 *
 * @param id
 *          the view id, must not be {@code null}
 */
public static void openView(final String id) {
  Assert.isNotNull(id, "id");
  PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

    @Override
    public void run() {
      try {
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(id);
      } catch (final PartInitException exception) {
        throw new AssertionFailedException("Could not open change view: " + exception.getLocalizedMessage());
      }
    }
  });
}
项目:tlaplus    文件:RenameSpecHandlerTest.java   
private SWTBotTreeItem checkForModelExistenceUI(final SWTBotTreeItem treeItem) {
    try {
        treeItem.expand();
        SWTBotTreeItem models = treeItem.getNode("models");
        models.expand();
        return models.getNode(TEST_MODEL).select();
    } catch(AssertionFailedException e) {
        Assert.fail(e.getMessage());
    }
    return null;
}
项目:OpenSPIFe    文件:BasicPerspectiveFactory.java   
public void setViewMovableAndClosable(IPageLayout layout, String id, boolean state) {
try {
    layout.getViewLayout(id).setCloseable(state);
    layout.getViewLayout(id).setMoveable(state);
} catch (AssertionFailedException e) {
    LogUtil.error("Can not find view id: "+id,e);
}
  }
项目:OpenSPIFe    文件:BasicPerspectiveFactory.java   
public void setViewMovableNotClosable(IPageLayout layout, String id) {
    try {
        layout.getViewLayout(id).setCloseable(false);
        layout.getViewLayout(id).setMoveable(true);
    } catch (AssertionFailedException e) {
        LogUtil.error("Can not find view id: "+id,e);
    }
}
项目:xiliary    文件:AdaptersPDETest.java   
@Test
public void getAdapterFromAdapterRegistryWithNonMatchingAdapterType() {
  Collection<Object> expected = new ArrayList<Object>();
  registerAdapterFactory( stubAdapterFactory( expected ), Boolean.class );

  Throwable actual = thrownBy( () -> adapters.getAdapter( Boolean.TRUE, ADAPTER_TYPE_2 ) );

  assertThat( actual ).isInstanceOf( AssertionFailedException.class );
}
项目:CharmMylynConnector    文件:CharmTaskDataHandlerTest.java   
@Test(expected = AssertionFailedException.class)
public void testEmptyId() throws ParseException, CoreException {
    CharmTask task = new CharmTask();
    taskDataHandler.parseCharmTask(repository, task, null);
}
项目:dsl-devkit    文件:CustomClassAwareEcoreGenerator.java   
@Override
@Deprecated
public void addSrcPath(final String srcPath) {
  throw new AssertionFailedException("srcPath should not be used in CustomClassAwareEcoreGenerator");
}
项目:strutsclipse    文件:ParseUtilTest.java   
@Test(expected = AssertionFailedException.class)
public void testDelimitedStringToSetNoDelimiter() throws Exception {
    final String str = "single";
    ParseUtil.delimitedStringToSet(str, null);
}
项目:xiliary    文件:AdaptersPDETest.java   
@Test( expected = AssertionFailedException.class )
public void getAdapterWithNullAdapterType() {
  adapters.getAdapter( mock( ADAPTER_TYPE_2 ), null );
}
项目:dsl-devkit    文件:CoreSwtbotTools.java   
/**
 * Returns the full text of the first CcomboItem found with the given prefix.
 * <p>
 * <em>Note</em>: Throws an AssertionError if the item could not be found.
 * </p>
 *
 * @param ccombo
 *          the ccomboBox to search in, must not be {@code null}
 * @param prefix
 *          the prefix of the item to search for, must not be {@code null}
 * @return the full name of the item as string, never {@code null}
 */
public static String getCcomboItemText(final SWTBotCCombo ccombo, final String prefix) {
  Assert.isNotNull(ccombo, "ccombo");
  Assert.isNotNull(prefix, "prefix");
  for (String ccomboItem : ccombo.items()) {
    if (ccomboItem.startsWith(prefix)) {
      return ccomboItem;
    }
  }
  throw new AssertionFailedException(NLS.bind("Must have a CcomboItem named ''{0}''.", prefix));
}
项目:che    文件:IQuickFixableAnnotation.java   
/**
 * Tells whether there are quick fixes for this annotation.
 *
 * <p><strong>Note:</strong> This method must only be called if {@link #isQuickFixableStateSet()}
 * returns <code>true</code>.
 *
 * @return <code>true</code> if this annotation offers quick fixes
 * @throws AssertionFailedException if called when {@link #isQuickFixableStateSet()} is <code>
 *     false</code>
 */
boolean isQuickFixable() throws AssertionFailedException;
项目:textuml    文件:MDDUtil.java   
/**
 * Returns the nearest parent of the given class. Fails if cannot find one.
 * Returns the reference itself if is an instance of the given class.
 * 
 * @param reference
 *            the reference element
 * @param eClass
 *            the type
 * @return any enclosing element of the given class
 */
public static <T extends Element> T getNearest(Element reference, EClass eClass) {
    Optional<T> result = findNearest(reference, eClass);
    return result.orElseThrow(() -> new AssertionFailedException("No '" + eClass.getName() + "' around "));
}