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


Java IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR属性代码示例

本文整理汇总了Java中org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR属性的具体用法?Java IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR怎么用?Java IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes的用法示例。


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

示例1: createArgument

/**
 * Creates a refactoring argument with the specified name and value.
 *
 * <p>If no refactoring is currently processed, this call has no effect.
 *
 * @param name the non-empty name of the argument
 * @param value the value of the argument
 * @throws CoreException if an error occurs while creating a new argument
 */
public void createArgument(final String name, final String value) throws CoreException {
  Assert.isNotNull(name);
  Assert.isTrue(!"".equals(name)); // $NON-NLS-1$
  Assert.isNotNull(value);
  if (fDocument != null && fRefactoringArguments != null && value != null) {
    try {
      final Attr attribute = fDocument.createAttribute(name);
      attribute.setValue(value);
      fRefactoringArguments.add(attribute);
    } catch (DOMException exception) {
      throw new CoreException(
          new Status(
              IStatus.ERROR,
              RefactoringCorePlugin.getPluginId(),
              IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR,
              exception.getLocalizedMessage(),
              null));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:RefactoringSessionTransformer.java

示例2: checkDescriptor

private boolean checkDescriptor(RefactoringDescriptor descriptor, IUndoableOperation operation) {
  Assert.isNotNull(descriptor);
  try {
    final Map arguments = RefactoringHistoryManager.getArgumentMap(descriptor);
    if (arguments != null) RefactoringHistoryManager.checkArgumentMap(arguments);
  } catch (CoreException exception) {
    final IStatus status = exception.getStatus();
    if (status.getCode() == IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR) {
      final String time =
          DateFormat.getDateTimeInstance().format(new Date(descriptor.getTimeStamp()));
      final String message =
          "The refactoring executed at "
              + time
              + " contributed a refactoring descriptor with invalid format:"; // $NON-NLS-1$//$NON-NLS-2$
      final IStatus comment =
          new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), descriptor.getComment());
      RefactoringCorePlugin.log(
          new MultiStatus(
              RefactoringCorePlugin.getPluginId(), 0, new IStatus[] {comment}, message, null));
    }
    RefactoringCorePlugin.log(exception);

    if (operation instanceof TriggeredOperations) {
      operation = ((TriggeredOperations) operation).getTriggeringOperation();
    }
    if (operation instanceof UndoableOperation2ChangeAdapter) {
      ((UndoableOperation2ChangeAdapter) operation).setChangeDescriptor(null);
    }
    return false;
  }
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:RefactoringHistoryService.java

示例3: checkArgumentMap

/**
 * Checks whether the argument map is well-formed.
 *
 * <p>All arguments contained in the map are checked according to the rules of {@link
 * RefactoringDescriptor}.
 *
 * @param arguments the argument map
 * @throws CoreException if the argument violates any of the constraints
 */
public static void checkArgumentMap(final Map arguments) throws CoreException {
  Assert.isNotNull(arguments);
  for (final Iterator iterator = arguments.entrySet().iterator(); iterator.hasNext(); ) {
    final Map.Entry entry = (Map.Entry) iterator.next();
    if (entry.getKey() instanceof String) {
      final String string = (String) entry.getKey();
      final char[] characters = string.toCharArray();
      if (characters.length == 0) {
        throw new CoreException(
            new Status(
                IStatus.ERROR,
                RefactoringCore.ID_PLUGIN,
                IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR,
                RefactoringCoreMessages.RefactoringHistoryManager_empty_argument,
                null));
      }
      for (int index = 0; index < characters.length; index++) {
        if (Character.isWhitespace(characters[index]))
          throw new CoreException(
              new Status(
                  IStatus.ERROR,
                  RefactoringCore.ID_PLUGIN,
                  IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR,
                  RefactoringCoreMessages.RefactoringHistoryManager_whitespace_argument_key,
                  null));
      }
    } else {
      throw new CoreException(
          new Status(
              IStatus.ERROR,
              RefactoringCore.ID_PLUGIN,
              IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR,
              Messages.format(
                  RefactoringCoreMessages.RefactoringHistoryManager_non_string_argument,
                  entry.getKey()),
              null));
    }
    if (!(entry.getValue() instanceof String)) {
      throw new CoreException(
          new Status(
              IStatus.ERROR,
              RefactoringCore.ID_PLUGIN,
              IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR,
              Messages.format(
                  RefactoringCoreMessages.RefactoringHistoryManager_non_string_value,
                  entry.getKey()),
              null));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:59,代码来源:RefactoringHistoryManager.java


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