本文整理汇总了Java中org.eclipse.jdt.internal.ui.JavaPlugin.logErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:Java JavaPlugin.logErrorMessage方法的具体用法?Java JavaPlugin.logErrorMessage怎么用?Java JavaPlugin.logErrorMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.ui.JavaPlugin
的用法示例。
在下文中一共展示了JavaPlugin.logErrorMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchForDeclarationsOfClashingMethods
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
private IMethod[] searchForDeclarationsOfClashingMethods(IProgressMonitor pm)
throws CoreException {
final List<IMethod> results = new ArrayList<IMethod>();
SearchPattern pattern = createNewMethodPattern();
IJavaSearchScope scope = RefactoringScopeFactory.create(getMethod().getJavaProject());
SearchRequestor requestor =
new SearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
Object method = match.getElement();
if (method
instanceof
IMethod) // check for bug 90138: [refactoring] [rename] Renaming method throws
// internal exception
results.add((IMethod) method);
else
JavaPlugin.logErrorMessage(
"Unexpected element in search match: " + match.toString()); // $NON-NLS-1$
}
};
new SearchEngine()
.search(pattern, SearchUtils.getDefaultSearchParticipants(), scope, requestor, pm);
return results.toArray(new IMethod[results.size()]);
}
示例2: checkNewElementName
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public RefactoringStatus checkNewElementName(String name) throws CoreException {
Assert.isNotNull(name);
RefactoringStatus result = Checks.checkTypeParameterName(name, fTypeParameter);
if (Checks.startsWithLowerCase(name))
result.addWarning(
RefactoringCoreMessages.RenameTypeParameterRefactoring_should_start_lowercase);
if (Checks.isAlreadyNamed(fTypeParameter, name))
result.addFatalError(RefactoringCoreMessages.RenameTypeParameterRefactoring_another_name);
IMember member = fTypeParameter.getDeclaringMember();
if (member instanceof IType) {
IType type = (IType) member;
if (type.getTypeParameter(name).exists())
result.addFatalError(
RefactoringCoreMessages
.RenameTypeParameterRefactoring_class_type_parameter_already_defined);
} else if (member instanceof IMethod) {
IMethod method = (IMethod) member;
if (method.getTypeParameter(name).exists())
result.addFatalError(
RefactoringCoreMessages
.RenameTypeParameterRefactoring_method_type_parameter_already_defined);
} else {
JavaPlugin.logErrorMessage(
"Unexpected sub-type of IMember: " + member.getClass().getName()); // $NON-NLS-1$
Assert.isTrue(false);
}
return result;
}
示例3: createRenameChanges
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
/**
* Creates the necessary changes for the renaming of the type parameter.
*
* @param monitor the progress monitor to display progress
* @return the status of the operation
* @throws CoreException if the change could not be generated
*/
private RefactoringStatus createRenameChanges(IProgressMonitor monitor) throws CoreException {
Assert.isNotNull(monitor);
RefactoringStatus status = new RefactoringStatus();
try {
monitor.beginTask(RefactoringCoreMessages.RenameTypeParameterRefactoring_searching, 2);
ICompilationUnit cu = fTypeParameter.getDeclaringMember().getCompilationUnit();
CompilationUnit root = RefactoringASTParser.parseWithASTProvider(cu, true, null);
CompilationUnitRewrite rewrite = new CompilationUnitRewrite(cu, root);
IMember member = fTypeParameter.getDeclaringMember();
ASTNode declaration = null;
if (member instanceof IMethod) {
declaration = ASTNodeSearchUtil.getMethodDeclarationNode((IMethod) member, root);
} else if (member instanceof IType) {
declaration = ASTNodeSearchUtil.getAbstractTypeDeclarationNode((IType) member, root);
} else {
JavaPlugin.logErrorMessage(
"Unexpected sub-type of IMember: " + member.getClass().getName()); // $NON-NLS-1$
Assert.isTrue(false);
}
monitor.worked(1);
RenameTypeParameterVisitor visitor =
new RenameTypeParameterVisitor(rewrite, fTypeParameter.getNameRange(), status);
if (declaration != null) declaration.accept(visitor);
fChange = visitor.getResult();
} finally {
monitor.done();
}
return status;
}
示例4: getNewElement
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public Object getNewElement() throws CoreException {
IMember member = fTypeParameter.getDeclaringMember();
if (member instanceof IType) {
IType type = (IType) member;
return type.getTypeParameter(getNewElementName());
} else if (member instanceof IMethod) {
IMethod method = (IMethod) member;
return method.getTypeParameter(getNewElementName());
} else {
JavaPlugin.logErrorMessage(
"Unexpected sub-type of IMember: " + member.getClass().getName()); // $NON-NLS-1$
Assert.isTrue(false);
}
return null;
}
示例5: rewriteImports
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public void rewriteImports(TextChangeManager changeManager, IProgressMonitor pm)
throws CoreException {
for (Iterator<Entry<ICompilationUnit, ImportChange>> iter =
fImportChanges.entrySet().iterator();
iter.hasNext(); ) {
Entry<ICompilationUnit, ImportChange> entry = iter.next();
ICompilationUnit cu = entry.getKey();
ImportChange importChange = entry.getValue();
ImportRewrite importRewrite = StubUtility.createImportRewrite(cu, true);
importRewrite.setFilterImplicitImports(false);
for (Iterator<String> iterator = importChange.fStaticToRemove.iterator();
iterator.hasNext(); ) {
importRewrite.removeStaticImport(iterator.next());
}
for (Iterator<String> iterator = importChange.fToRemove.iterator(); iterator.hasNext(); ) {
importRewrite.removeImport(iterator.next());
}
for (Iterator<String[]> iterator = importChange.fStaticToAdd.iterator();
iterator.hasNext(); ) {
String[] toAdd = iterator.next();
importRewrite.addStaticImport(toAdd[0], toAdd[1], true);
}
for (Iterator<String> iterator = importChange.fToAdd.iterator(); iterator.hasNext(); ) {
importRewrite.addImport(iterator.next());
}
if (importRewrite.hasRecordedChanges()) {
TextEdit importEdit = importRewrite.rewriteImports(pm);
String name = RefactoringCoreMessages.RenamePackageRefactoring_update_imports;
try {
TextChangeCompatibility.addTextEdit(changeManager.get(cu), name, importEdit);
} catch (MalformedTreeException e) {
JavaPlugin.logErrorMessage(
"MalformedTreeException while processing cu " + cu); // $NON-NLS-1$
throw e;
}
}
}
}
示例6: read
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public final int read() {
if (fOffset == fBufferLength) {
int end = fBufferOffset + fBufferLength;
if (end == fDocument.getLength() || end == fRangeOffset + fRangeLength) return EOF;
else {
updateBuffer(fBufferOffset + fBufferLength);
fOffset = 0;
}
}
try {
return fBuffer[fOffset++];
} catch (ArrayIndexOutOfBoundsException ex) {
StringBuffer buf = new StringBuffer();
buf.append("Detailed state of 'BufferedDocumentScanner:'"); // $NON-NLS-1$
buf.append("\n\tfOffset= "); // $NON-NLS-1$
buf.append(fOffset);
buf.append("\n\tfBufferOffset= "); // $NON-NLS-1$
buf.append(fBufferOffset);
buf.append("\n\tfBufferLength= "); // $NON-NLS-1$
buf.append(fBufferLength);
buf.append("\n\tfRangeOffset= "); // $NON-NLS-1$
buf.append(fRangeOffset);
buf.append("\n\tfRangeLength= "); // $NON-NLS-1$
buf.append(fRangeLength);
JavaPlugin.logErrorMessage(buf.toString());
throw ex;
}
}