org.eclipse.ltk.core.refactoring.RefactoringStatus.getEntryMatchingSeverity()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(111)

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

RefactoringStatus.getEntryMatchingSeverity介绍

[英]Returns the first entry which severity is equal or greater than the given severity. If more than one entry exists that matches the criteria the first one is returned. Returns null if no entry matches.
[中]返回第一个严重性等于或大于给定严重性的条目。如果存在多个符合条件的条目,则返回第一个条目。如果没有匹配的条目,则返回null

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.ltk.core.refactoring

/**
 * Returns the first message which severity is equal or greater than the
 * given severity. If more than one entry exists that matches the criteria
 * the first one is returned. Returns <code>null</code> if no entry matches.
 *
 * @param severity the severity to search for. Must be one of <code>FATAL
 *  </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
 * @return the message of the entry that matches the search criteria
 */
public String getMessageMatchingSeverity(int severity) {
  RefactoringStatusEntry entry= getEntryMatchingSeverity(severity);
  if (entry == null)
    return null;
  return entry.getMessage();
}

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

/**
 * Returns the first message which severity is equal or greater than the
 * given severity. If more than one entry exists that matches the criteria
 * the first one is returned. Returns <code>null</code> if no entry matches.
 * 
 * @param severity the severity to search for. Must be one of <code>FATAL
 *  </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
 * @return the message of the entry that matches the search criteria
 */
public String getMessageMatchingSeverity(int severity) {
  RefactoringStatusEntry entry= getEntryMatchingSeverity(severity);
  if (entry == null)
    return null;
  return entry.getMessage();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ltk.core.refactoring

/**
 * Returns the first message which severity is equal or greater than the
 * given severity. If more than one entry exists that matches the criteria
 * the first one is returned. Returns <code>null</code> if no entry matches.
 *
 * @param severity the severity to search for. Must be one of <code>FATAL
 *  </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
 * @return the message of the entry that matches the search criteria
 */
public String getMessageMatchingSeverity(int severity) {
  RefactoringStatusEntry entry= getEntryMatchingSeverity(severity);
  if (entry == null)
    return null;
  return entry.getMessage();
}

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

/**
 * Executes some light weight precondition checking. If the returned status
 * is an error then the refactoring can't be executed at all. However,
 * returning an OK status doesn't guarantee that the refactoring can be
 * executed. It may still fail while performing the exhaustive precondition
 * checking done inside the methods <code>openDialog</code> or
 * <code>perform</code>.
 *
 * The method is mainly used to determine enable/disablement of actions.
 *
 * @return the result of the light weight precondition checking.
 *
 * @throws CoreException if an unexpected exception occurs while performing the checking.
 *
 * @see #openDialog(Shell)
 * @see #perform(Shell, IRunnableContext)
 */
public IStatus preCheck() throws CoreException {
  //ensureChecked();
  if (fPreCheckStatus.hasFatalError()) {
    return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus();
  } else {
    return Status.OK_STATUS;
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

/**
 * Executes some light weight precondition checking. If the returned status
 * is an error then the refactoring can't be executed at all. However,
 * returning an OK status doesn't guarantee that the refactoring can be
 * executed. It may still fail while performing the exhaustive precondition
 * checking done inside the methods <code>openDialog</code> or
 * <code>perform</code>.
 *
 * The method is mainly used to determine enable/disablement of actions.
 *
 * @return the result of the light weight precondition checking.
 *
 * @throws CoreException if an unexpected exception occurs while performing the checking.
 *
 * @see #openDialog(Shell)
 * @see #perform(Shell, IRunnableContext)
 */
public IStatus preCheck() throws CoreException {
  ensureChecked();
  if (fPreCheckStatus.hasFatalError())
    return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus();
  else
    return Status.OK_STATUS;
}

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

/**
 * Executes some light weight precondition checking. If the returned status
 * is an error then the refactoring can't be executed at all. However,
 * returning an OK status doesn't guarantee that the refactoring can be
 * executed. It may still fail while performing the exhaustive precondition
 * checking done inside the methods <code>openDialog</code> or
 * <code>perform</code>.
 *
 * The method is mainly used to determine enable/disablement of actions.
 *
 * @return the result of the light weight precondition checking.
 *
 * @throws CoreException if an unexpected exception occurs while performing the checking.
 *
 * @see #openDialog(Shell)
 * @see #perform(Shell, IRunnableContext)
 */
public IStatus preCheck() throws CoreException {
  ensureChecked();
  if (fPreCheckStatus.hasFatalError())
    return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus();
  else
    return Status.OK_STATUS;
}

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

/**
 * Executes some light weight precondition checking. If the returned status
 * is an error then the refactoring can't be executed at all. However,
 * returning an OK status doesn't guarantee that the refactoring can be
 * executed. It may still fail while performing the exhaustive precondition
 * checking done inside the methods <code>openDialog</code> or
 * <code>perform</code>.
 * 
 * The method is mainly used to determine enable/disablement of actions.
 * 
 * @return the result of the light weight precondition checking.
 * 
 * @throws CoreException if an unexpected exception occurs while performing the checking.
 * 
 * @see #openDialog(Shell)
 * @see #perform(Shell, IRunnableContext)
 */
public IStatus preCheck() throws CoreException {
  ensureChecked();
  if (fPreCheckStatus.hasFatalError())
    return fPreCheckStatus.getEntryMatchingSeverity(RefactoringStatus.FATAL).toStatus();
  else
    return new Status(IStatus.OK, JavaPlugin.getPluginId(), 0, "", null); //$NON-NLS-1$
}

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

public final boolean activate(final Refactoring ref, final Shell parent, final int saveMode) throws CoreException {
    final RefactoringStatus status= ref.checkInitialConditions(new NullProgressMonitor());
    if (status.hasFatalError()) {
      final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
      if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
        String message= entry.getMessage();
        final Object element= entry.getData();
        message= message + RefactoringMessages.RefactoringErrorDialogUtil_okToPerformQuestion;
        if (element != null && MessageDialog.openQuestion(shell, RefactoringMessages.OpenRefactoringWizardAction_refactoring, message)) {
          final IStructuredSelection selection= new StructuredSelection(element);
          // TODO: should not hijack this
          // ModifiyParametersAction.
          // The action is set up on an editor, but we use it
          // as if it were set up on a ViewPart.
          boolean wasEnabled= action.isEnabled();
          action.selectionChanged(selection);
          if (action.isEnabled()) {
            action.run(selection);
          } else {
            MessageDialog.openInformation(shell, ActionMessages.ModifyParameterAction_problem_title, ActionMessages.ModifyParameterAction_problem_message);
          }
          action.setEnabled(wasEnabled);
        }
        return false;
      }
    }
    return super.activate(ref, parent, saveMode);
  }
};

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

final RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor());
if (status.hasFatalError()) {
  final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {

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

result.merge(fChangeSignatureRefactoring.checkInitialConditions(new SubProgressMonitor(pm, 1)));
if (result.hasFatalError()) {
  RefactoringStatusEntry entry= result.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {

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

RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor());
if (status.hasFatalError()) {
  RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  MessageDialog.openInformation(getShell(), getDialogTitle(), entry.getMessage());
  if (entry.getContext() instanceof JavaStatusContext && fEditor != null) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

result.merge(fChangeSignatureProcessor.checkInitialConditions(new SubProgressMonitor(pm, 1)));
if (result.hasFatalError()) {
  RefactoringStatusEntry entry= result.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor());
if (status.hasFatalError()) {
  RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  MessageDialog.openInformation(getShell(), getDialogTitle(), entry.getMessage());
  if (entry.getContext() instanceof JavaStatusContext && fEditor != null) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
  final Object element= entry.getData();

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

result.merge(fChangeSignatureProcessor.checkInitialConditions(new SubProgressMonitor(pm, 1)));
if (result.hasFatalError()) {
  RefactoringStatusEntry entry= result.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {

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

RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor());
if (status.hasFatalError()) {
  final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
    Object element= entry.getData();

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor());
if (status.hasFatalError()) {
  final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
    Object element= entry.getData();

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

final RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
if (entry.getCode() == RefactoringStatusCodes.OVERRIDES_ANOTHER_METHOD || entry.getCode() == RefactoringStatusCodes.METHOD_DECLARED_IN_INTERFACE) {
  final Object element= entry.getData();

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

RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor());
if (status.hasFatalError()) {
  RefactoringStatusEntry entry= status.getEntryMatchingSeverity(RefactoringStatus.FATAL);
  MessageDialog.openInformation(getShell(), getDialogTitle(), entry.getMessage());
  if (entry.getContext() instanceof JavaStatusContext && fEditor != null) {

相关文章