org.eclipse.core.runtime.Assert.isNotNull()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.eclipse.core.runtime.Assert.isNotNull()方法的一些代码示例,展示了Assert.isNotNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.isNotNull()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Assert
类名称:Assert
方法名:isNotNull

Assert.isNotNull介绍

[英]Asserts that the given object is not null. If this is not the case, some kind of unchecked exception is thrown.
[中]断言给定对象不是null。如果不是这样,则会引发某种未经检查的异常。

代码示例

代码示例来源:origin: org.eclipse.core/runtime

Assert.isNotNull(descriptor);
Assert.isTrue(!CompatibilityHelper.hasPluginObject(descriptor), NLS.bind(Messages.plugin_deactivatedLoad, this.getClass().getName(), descriptor.getUniqueIdentifier() + " is not activated")); //$NON-NLS-1$
this.descriptor = descriptor;

代码示例来源:origin: inspectIT/inspectIT

/**
 * Only constructor which needs an input definition.
 *
 * @param inputDefinition
 *            The input definition.
 */
public RootEditorInput(InputDefinition inputDefinition) {
  Assert.isNotNull(inputDefinition);
  this.inputDefinition = inputDefinition;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public void setInputDefinition(InputDefinition inputDefinition) {
  Assert.isNotNull(inputDefinition);
  this.inputDefinition = inputDefinition;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public void setRootEditor(IRootEditor rootEditor) {
  Assert.isNotNull(rootEditor);
  this.rootEditor = rootEditor;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * @return the rootEditor
 */
protected IRootEditor getRootEditor() {
  Assert.isNotNull(rootEditor);
  return rootEditor;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public AbstractRootEditor getRootEditor() {
  Assert.isNotNull(rootEditor);
  return rootEditor;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * @param profile
 *            {@link Profile}.
 * @param cmrRepositoryDefinition
 *            {@link CmrRepositoryDefinition}.
 */
public ProfileEditorInput(Profile profile, CmrRepositoryDefinition cmrRepositoryDefinition) {
  Assert.isNotNull(profile);
  Assert.isNotNull(cmrRepositoryDefinition);
  this.profile = profile;
  this.cmrRepositoryDefinition = cmrRepositoryDefinition;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

public GenerateGetterSetterOperation(IType type, CompilationUnit astRoot) {
  Assert.isNotNull(type);
  this.type = type;
  this.astRoot = astRoot;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

@Override
public void setFilePatterns(String patterns) {
  Assert.isNotNull(patterns);
  fFilePatterns = patterns;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

public RefactoringScanner(String name, String qualifier) {
  Assert.isNotNull(name);
  Assert.isNotNull(qualifier);
  fName= name;
  fQualifier= qualifier;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

/**
   * Sets the refactoring status for this search engine.
   * <p>
   * This method must be called before start searching. The default is an empty status with status {@link RefactoringStatus#OK}.
   *
   * @param status the refactoring status to set
   */
  public final void setStatus(final RefactoringStatus status) {
    Assert.isNotNull(status);
    fStatus= status;
  }
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public void registerCallback(PreferenceEventCallback callback) {
  Assert.isNotNull(callback);
  callbacks.add(callback);
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

/**
 * Returns with the scopes for the given scope index. Never {@code null} nor
 * empty. If not found, throws an exception.
 */
public static List<String> getScopes(int index) {
  List<String> scopes = LOOKUP_TABLE.get(index);
  Assert.isNotNull(scopes, "No scopes were registered for index: " + index);
  return scopes;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

public Destination(Object destination, int location) {
  Assert.isNotNull(destination);
  Assert.isLegal(location == LOCATION_AFTER || location == LOCATION_BEFORE || location == LOCATION_ON);
  fDestination= destination;
  fLocation= location;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private TagElement createJavadocMemberReferenceTag(BodyDeclaration declaration, final AST ast) throws JavaModelException {
  Assert.isNotNull(ast);
  Assert.isNotNull(declaration);
  ASTNode javadocReference= createDocReference(declaration);
  final TagElement element= ast.newTagElement();
  element.setTagName(TagElement.TAG_LINK);
  element.fragments().add(javadocReference);
  return element;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private IResource getCommonResourceParent() {
  Assert.isNotNull(fResources);
  Assert.isTrue(fResources.length > 0);//safe - checked before
  return fResources[0].getParent();
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

/**
 * Creates a new return statement for the method invocation.
 *
 * @param invocation the method invocation to create a return statement for
 * @return the corresponding statement
 */
private ReturnStatement createReturnStatement(final MethodInvocation invocation) {
  Assert.isNotNull(invocation);
  final ReturnStatement statement= invocation.getAST().newReturnStatement();
  statement.setExpression(invocation);
  return statement;
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * Checks that the editor input has profile with the {@link ExcludeRulesProfileData}. If so,
 * sets the {@link #profile} and {@link #profileData}.
 */
private void checkAndGetEditorInput() {
  ProfileEditorInput input = (ProfileEditorInput) formPage.getEditor().getEditorInput();
  Assert.isNotNull(input.getProfile());
  Assert.isNotNull(input.getProfile().getProfileData());
  Assert.isLegal(input.getProfile().getProfileData().isOfType(ExcludeRulesProfileData.class), "Given profile can not be opened with the exclude rules part.");
  profile = input.getProfile();
  profileData = profile.getProfileData().getIfInstance(ExcludeRulesProfileData.class);
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * Checks that the editor input has profile with the {@link SensorAssignmentProfileData}. If so,
 * sets the {@link #profile} and {@link #profileData}.
 */
private void checkAndGetEditorInput() {
  ProfileEditorInput input = (ProfileEditorInput) formPage.getEditor().getEditorInput();
  Assert.isNotNull(input.getProfile());
  Assert.isNotNull(input.getProfile().getProfileData());
  Assert.isLegal(input.getProfile().getProfileData().isOfType(SensorAssignmentProfileData.class), "Given profile can not be opened with the exclude rules part.");
  this.profile = input.getProfile();
  this.profileData = profile.getProfileData().getIfInstance(SensorAssignmentProfileData.class);
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private static InfixExpression findGroupRoot(InfixExpression node) {
  Assert.isTrue(isAssociativeInfix(node));
  while (!isAGroupRoot(node)) {
    ASTNode parent = node.getParent();
    Assert.isNotNull(parent);
    Assert.isTrue(isAssociativeInfix(parent));
    Assert.isTrue(((InfixExpression) parent).getOperator() == node.getOperator());
    node = (InfixExpression) parent;
  }
  return node;
}

相关文章