本文整理汇总了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();
}
}
});
}
示例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.");
}
示例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
}
}
示例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());
}
}
});
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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 );
}
示例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);
}
示例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");
}
示例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);
}
示例12: getAdapterWithNullAdapterType
import org.eclipse.core.runtime.AssertionFailedException; //导入依赖的package包/类
@Test( expected = AssertionFailedException.class )
public void getAdapterWithNullAdapterType() {
adapters.getAdapter( mock( ADAPTER_TYPE_2 ), null );
}
示例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));
}
示例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;
示例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 "));
}