本文整理汇总了Java中org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes类的典型用法代码示例。如果您正苦于以下问题:Java IRefactoringCoreStatusCodes类的具体用法?Java IRefactoringCoreStatusCodes怎么用?Java IRefactoringCoreStatusCodes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRefactoringCoreStatusCodes类属于org.eclipse.ltk.core.refactoring包,在下文中一共展示了IRefactoringCoreStatusCodes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createArgument
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
/**
* 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));
}
}
}
示例2: getCachedSession
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
/**
* Returns the cached refactoring session descriptor.
*
* @param store the file store of the descriptor
* @param projectName project name, or <code>null</code> for the workspace
* @param input the input stream where to read the descriptor
* @return the cached refactoring session descriptor
* @throws CoreException if an error occurs while reading the session
*/
private RefactoringSessionDescriptor getCachedSession(
final IFileStore store, String projectName, final InputStream input) throws CoreException {
if (store.equals(fCachedStore) && fCachedDescriptor != null) return fCachedDescriptor;
final RefactoringSessionDescriptor descriptor;
try {
descriptor =
new RefactoringSessionReader(false, projectName).readSession(new InputSource(input));
fCachedDescriptor = descriptor;
fCachedStore = store;
return descriptor;
} catch (CoreException e) {
throw new CoreException(
new MultiStatus(
RefactoringCorePlugin.getPluginId(),
IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR,
new IStatus[] {e.getStatus()},
Messages.format(
RefactoringCoreMessages.RefactoringHistoryManager_error_reading_file,
BasicElementLabels.getURLPart(store.toURI().toString())),
null));
}
}
示例3: add
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
/**
* Adds the given condition checker. An exception will be thrown if a checker of the same type
* already exists in this context.
*
* @param checker the checker to add
* @throws CoreException if a checker of the same type already exists
*/
public void add(IConditionChecker checker) throws CoreException {
Object old = fCheckers.put(checker.getClass(), checker);
if (old != null) {
fCheckers.put(checker.getClass(), old);
throw new CoreException(
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
IRefactoringCoreStatusCodes.CHECKER_ALREADY_EXISTS_IN_CONTEXT,
Messages.format(
RefactoringCoreMessages.CheckConditionContext_error_checker_exists,
checker.getClass().toString()),
null));
}
}
示例4: internalHandleException
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
protected void internalHandleException(Change change, Throwable e) {
if (e instanceof OperationCanceledException) return;
RefactoringParticipant participant = (RefactoringParticipant) fParticipantMap.get(change);
if (participant != null) {
disableParticipant(participant, e);
} else if (fPreChangeParticipants != null) {
// The main refactoring, get rid of any participants with pre changes
IStatus status =
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
IRefactoringCoreStatusCodes.REFACTORING_EXCEPTION_DISABLED_PARTICIPANTS,
RefactoringCoreMessages.ProcessorBasedRefactoring_prechange_participants_removed,
e);
ResourcesPlugin.log(status);
Iterator it = fPreChangeParticipants.iterator();
while (it.hasNext()) {
participant = (RefactoringParticipant) it.next();
disableParticipant(participant, null);
}
}
}
示例5: addModified
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
private static IStatus addModified(IStatus status, IFile file) {
IStatus entry =
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
IRefactoringCoreStatusCodes.VALIDATE_EDIT_CHANGED_CONTENT,
Messages.format(
RefactoringCoreMessages.Resources_fileModified,
BasicElementLabels.getPathLabel(file.getFullPath(), false)),
null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
((MultiStatus) status).add(entry);
return status;
} else {
MultiStatus result =
new MultiStatus(
RefactoringCorePlugin.getPluginId(),
IRefactoringCoreStatusCodes.VALIDATE_EDIT_CHANGED_CONTENT,
RefactoringCoreMessages.Resources_modifiedResources,
null);
result.add(status);
result.add(entry);
return result;
}
}
示例6: asCoreException
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
public static CoreException asCoreException(BadLocationException e) {
String message = e.getMessage();
if (message == null) message = "BadLocationException"; // $NON-NLS-1$
return new CoreException(
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
IRefactoringCoreStatusCodes.BAD_LOCATION,
message,
e));
}
示例7: log
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
public static void log(Throwable t) {
IStatus status =
new Status(
IStatus.ERROR,
getPluginId(),
IRefactoringCoreStatusCodes.INTERNAL_ERROR,
RefactoringCoreMessages.RefactoringCorePlugin_internal_error,
t);
log(status);
}
示例8: logRemovedListener
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
public static void logRemovedListener(Throwable t) {
IStatus status =
new Status(
IStatus.ERROR,
getPluginId(),
IRefactoringCoreStatusCodes.INTERNAL_ERROR,
RefactoringCoreMessages.RefactoringCorePlugin_listener_removed,
t);
log(status);
}
示例9: logRemovedParticipant
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
public static void logRemovedParticipant(ParticipantDescriptor descriptor, Throwable t) {
IStatus status =
new Status(
IStatus.ERROR,
getPluginId(),
IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED,
Messages.format(
RefactoringCoreMessages.RefactoringCorePlugin_participant_removed,
descriptor.getId()),
t);
log(status);
}
示例10: logErrorMessage
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
public static void logErrorMessage(String message) {
log(
new Status(
IStatus.ERROR,
getPluginId(),
IRefactoringCoreStatusCodes.INTERNAL_ERROR,
message,
null));
}
示例11: throwCoreException
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
private void throwCoreException(Exception exception, String message) throws CoreException {
throw new CoreException(
new Status(
IStatus.ERROR,
RefactoringCorePlugin.getPluginId(),
IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR,
message,
exception));
}
示例12: createCoreException
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
/**
* Creates a new core exception representing an I/O error.
*
* @param exception the throwable to wrap
* @return the core exception
*/
private static CoreException createCoreException(final Throwable exception) {
return new CoreException(
new Status(
IStatus.ERROR,
RefactoringCore.ID_PLUGIN,
IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR,
exception.getLocalizedMessage(),
exception));
}
示例13: checkDescriptor
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
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;
}
示例14: checkArgumentMap
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
/**
* 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));
}
}
}
示例15: wrapBadLocationException
import org.eclipse.ltk.core.refactoring.IRefactoringCoreStatusCodes; //导入依赖的package包/类
private static CoreException wrapBadLocationException(BadLocationException e) {
String message= e.getMessage();
if (message == null)
message= "BadLocationException"; //$NON-NLS-1$
return new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IRefactoringCoreStatusCodes.BAD_LOCATION, message, e));
}