当前位置: 首页>>代码示例>>Java>>正文


Java AssertionFailedException类代码示例

本文整理汇总了Java中org.eclipse.core.runtime.AssertionFailedException的典型用法代码示例。如果您正苦于以下问题:Java AssertionFailedException类的具体用法?Java AssertionFailedException怎么用?Java AssertionFailedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AssertionFailedException类属于org.eclipse.core.runtime包,在下文中一共展示了AssertionFailedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: switchAndResetPerspective

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
/**
 * 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();
      }
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:29,代码来源:CoreSwtbotTools.java

示例2: applyLinkedRename

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
/**
 * 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.");
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:RefactoringManager.java

示例3: assertCreateProjectWithBadNameArg

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
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
	}
}
 
开发者ID:Imhotup,项目名称:LibertyEiffel-Eclipse-Plugin,代码行数:10,代码来源:LEProjectSupportTest.java

示例4: openView

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
/**
 * 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());
      }
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:21,代码来源:CoreSwtbotTools.java

示例5: checkForModelExistenceUI

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
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;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:12,代码来源:RenameSpecHandlerTest.java

示例6: setViewMovableAndClosable

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
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);
}
  }
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:9,代码来源:BasicPerspectiveFactory.java

示例7: setViewMovableNotClosable

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
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);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:9,代码来源:BasicPerspectiveFactory.java

示例8: getAdapterFromAdapterRegistryWithNonMatchingAdapterType

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
@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 );
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:10,代码来源:AdaptersPDETest.java

示例9: testEmptyId

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
@Test(expected = AssertionFailedException.class)
public void testEmptyId() throws ParseException, CoreException {
	CharmTask task = new CharmTask();
	taskDataHandler.parseCharmTask(repository, task, null);
}
 
开发者ID:theits,项目名称:CharmMylynConnector,代码行数:6,代码来源:CharmTaskDataHandlerTest.java

示例10: addSrcPath

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
@Override
@Deprecated
public void addSrcPath(final String srcPath) {
  throw new AssertionFailedException("srcPath should not be used in CustomClassAwareEcoreGenerator");
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:6,代码来源:CustomClassAwareEcoreGenerator.java

示例11: testDelimitedStringToSetNoDelimiter

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
@Test(expected = AssertionFailedException.class)
public void testDelimitedStringToSetNoDelimiter() throws Exception {
	final String str = "single";
	ParseUtil.delimitedStringToSet(str, null);
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:6,代码来源:ParseUtilTest.java

示例12: getAdapterWithNullAdapterType

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
@Test( expected = AssertionFailedException.class )
public void getAdapterWithNullAdapterType() {
  adapters.getAdapter( mock( ADAPTER_TYPE_2 ), null );
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:5,代码来源:AdaptersPDETest.java

示例13: getCcomboItemText

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:23,代码来源:CoreSwtbotTools.java

示例14: isQuickFixable

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
/**
 * 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;
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:IQuickFixableAnnotation.java

示例15: getNearest

import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
/**
 * 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 "));
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:15,代码来源:MDDUtil.java


注:本文中的org.eclipse.core.runtime.AssertionFailedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。