本文整理汇总了Java中org.eclipse.jdt.internal.ui.JavaPlugin.log方法的典型用法代码示例。如果您正苦于以下问题:Java JavaPlugin.log方法的具体用法?Java JavaPlugin.log怎么用?Java JavaPlugin.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.ui.JavaPlugin
的用法示例。
在下文中一共展示了JavaPlugin.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendTypeParameterLabel
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
/**
* Appends the styled label for a type parameter.
*
* @param typeParameter the element to render
* @param flags the rendering flags. Flags with names starting with 'T_' are considered.
*/
public void appendTypeParameterLabel(ITypeParameter typeParameter, long flags) {
try {
appendTypeParameterWithBounds(typeParameter, flags);
// post qualification
if (getFlag(flags, JavaElementLabels.TP_POST_QUALIFIED)) {
fBuffer.append(JavaElementLabels.CONCAT_STRING);
IMember declaringMember = typeParameter.getDeclaringMember();
appendElementLabel(
declaringMember,
JavaElementLabels.M_PARAMETER_TYPES
| JavaElementLabels.M_FULLY_QUALIFIED
| JavaElementLabels.T_FULLY_QUALIFIED
| (flags & QUALIFIER_FLAGS));
}
} catch (JavaModelException e) {
JavaPlugin.log(e); // NotExistsException will not reach this point
}
}
示例2: getImportRewrite
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public ImportRewrite getImportRewrite() {
if (fImportRewrite == null) {
// lazily initialized to avoid lengthy processing in checkInitialConditions(..)
try {
/* If bindings are to be resolved, then create the AST, so that
* ImportRewrite#setUseContextToFilterImplicitImports(boolean) will be set to true
* and ContextSensitiveImportRewriteContext etc. can be used. */
if (fRoot == null && !fResolveBindings) {
fImportRewrite = StubUtility.createImportRewrite(fCu, true);
} else {
fImportRewrite = StubUtility.createImportRewrite(getRoot(), true);
}
} catch (CoreException e) {
JavaPlugin.log(e);
throw new IllegalStateException(e.getMessage()); // like ASTParser#createAST(..) does
}
}
return fImportRewrite;
}
示例3: createResolvers
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
/**
* Instantiates the resolvers contributed to the context type with id <code>contextTypeId</code>.
* If instantiation of one resolver fails, the exception are logged and operation continues.
*
* @param extensions the configuration elements to parse
* @param contextTypeId the id of the context type for which resolvers are instantiated
* @return the instantiated resolvers
*/
private static TemplateVariableResolver[] createResolvers(
IConfigurationElement[] extensions, String contextTypeId) {
List resolvers = new ArrayList();
for (int i = 0; i < extensions.length; i++) {
if (extensions[i].getName().equals(RESOLVER)) {
String declaredId = extensions[i].getAttribute(CONTEXT_TYPE_ID);
if (contextTypeId.equals(declaredId)) {
try {
TemplateVariableResolver resolver = createResolver(extensions[i]);
if (resolver != null) resolvers.add(resolver);
} catch (CoreException e) {
JavaPlugin.log(e);
}
}
}
}
return (TemplateVariableResolver[])
resolvers.toArray(new TemplateVariableResolver[resolvers.size()]);
}
示例4: deletePackage
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
/**
* Removes a package fragment. Retries if deletion failed (e.g. because the indexer still locks a
* file).
*
* @param pack the package to delete
* @throws CoreException if operation failed
*/
public static void deletePackage(IPackageFragment pack) throws CoreException {
for (int i = 0; i < MAX_RETRY; i++) {
try {
pack.delete(true, null);
i = MAX_RETRY;
} catch (CoreException e) {
if (i == MAX_RETRY - 1) {
JavaPlugin.log(e);
throw e;
}
try {
JavaPlugin.log(
new IllegalStateException(
"sleep before retrying JavaProjectHelper.delete() for package "
+ pack.getHandleIdentifier()));
Thread.sleep(RETRY_DELAY); // give other threads time to close the file
} catch (InterruptedException e1) {
}
}
}
}
示例5: isInsideJRE
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public boolean isInsideJRE(IJavaElement element) {
IPackageFragmentRoot root =
(IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
if (root != null) {
try {
IClasspathEntry entry = root.getRawClasspathEntry();
if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
IClasspathContainer container =
JavaCore.getClasspathContainer(entry.getPath(), root.getJavaProject());
return container != null && container.getKind() == IClasspathContainer.K_DEFAULT_SYSTEM;
}
return false;
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
}
return true; // include JRE in doubt
}
示例6: updateNode
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
@Override
public void updateNode() throws JavaModelException {
int start = fNode.getStartPosition();
int length = fNode.getLength();
String msg =
"Cannot update found node: nodeType="
+ fNode.getNodeType()
+ "; " // $NON-NLS-1$//$NON-NLS-2$
+ fNode.toString()
+ "["
+ start
+ ", "
+ length
+ "] in "
+ fCuRewrite.getCu(); // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
JavaPlugin.log(
new Exception(
msg
+ ":\n"
+ fCuRewrite
.getCu()
.getSource()
.substring(start, start + length))); // $NON-NLS-1$
fResult.addError(msg, JavaStatusContext.create(fCuRewrite.getCu(), fNode));
}
示例7: format
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
/**
* Old API. Consider to use format2 (TextEdit)
*
* @param kind Use to specify the kind of the code snippet to format. It can be any of the kind
* constants defined in {@link org.eclipse.jdt.core.formatter.CodeFormatter}
* @param source The source to format
* @param indentationLevel The initial indentation level, used to shift left/right the entire
* source fragment. An initial indentation level of zero or below has no effect.
* @param lineSeparator The line separator to use in formatted source, if set to <code>null</code>
* , then the platform default one will be used.
* @param options The options map to use for formatting with the default code formatter.
* Recognized options are documented on {@link
* org.eclipse.jdt.core.JavaCore#getDefaultOptions()}. If set to <code>null</code>, then use
* the current settings from {@link org.eclipse.jdt.core.JavaCore#getOptions()}.
* @return the formatted source string
*/
public static String format(
int kind,
String source,
int indentationLevel,
String lineSeparator,
Map<String, String> options) {
TextEdit edit = format2(kind, source, indentationLevel, lineSeparator, options);
if (edit == null) {
return source;
} else {
Document document = new Document(source);
try {
edit.apply(document, TextEdit.NONE);
} catch (BadLocationException e) {
JavaPlugin.log(e); // bug in the formatter
Assert.isTrue(
false,
"Formatter created edits with wrong positions: " + e.getMessage()); // $NON-NLS-1$
}
return document.get();
}
}
示例8: choosePackage
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
protected IPackageFragment choosePackage() {
IPackageFragmentRoot froot = getPackageFragmentRoot();
IJavaElement[] packages = null;
try {
if (froot != null && froot.exists()) {
packages = froot.getChildren();
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
if (packages == null) {
packages = new IJavaElement[0];
}
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_DEFAULT));
dialog.setIgnoreCase(false);
dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title);
dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description);
dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty);
dialog.setElements(packages);
dialog.setHelpAvailable(false);
if (dialog.open() == Window.OK) {
return (IPackageFragment) dialog.getFirstResult();
}
return null;
}
示例9: internalPerformFinish
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
private FinishResult internalPerformFinish(PerformChangeOperation op) {
op.setUndoManager(RefactoringCore.getUndoManager(), refactoring.getName());
try {
ResourcesPlugin.getWorkspace().run(op, new NullProgressMonitor());
} catch (CoreException e) {
JavaPlugin.log(e);
return FinishResult.createException();
}
return FinishResult.createOK();
}
示例10: preReplace
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
/**
* Called before document changes occur. It must be followed by a call to postReplace().
*
* @param document the document on which to track the reference position.
* @param offset the offset
* @throws org.eclipse.jface.text.BadLocationException if the offset describes an invalid range
* in this document
*/
public void preReplace(IDocument document, int offset) throws BadLocationException {
fPosition.setOffset(offset);
try {
document.addPositionCategory(CATEGORY);
document.addPositionUpdater(fPositionUpdater);
document.addPosition(CATEGORY, fPosition);
} catch (BadPositionCategoryException e) {
// should not happen
JavaPlugin.log(e);
}
}
示例11: hasFatalError
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
private static boolean hasFatalError(CompilationUnit compilationUnit) {
try {
if (!((ICompilationUnit) compilationUnit.getJavaElement()).isStructureKnown()) return true;
} catch (JavaModelException e) {
JavaPlugin.log(e);
return true;
}
IProblem[] problems = compilationUnit.getProblems();
for (int i = 0; i < problems.length; i++) {
if (problems[i].isError()) {
if (!(problems[i] instanceof CategorizedProblem)) return true;
CategorizedProblem categorizedProblem = (CategorizedProblem) problems[i];
int categoryID = categorizedProblem.getCategoryID();
if (categoryID == CategorizedProblem.CAT_BUILDPATH) return true;
if (categoryID == CategorizedProblem.CAT_SYNTAX) return true;
if (categoryID == CategorizedProblem.CAT_IMPORT) return true;
if (categoryID == CategorizedProblem.CAT_TYPE) return true;
if (categoryID == CategorizedProblem.CAT_MEMBER) return true;
if (categoryID == CategorizedProblem.CAT_INTERNAL) return true;
}
}
return false;
}
示例12: getImageForType
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
private Image getImageForType(IType type) {
ImageDescriptor imageName = JavaPluginImages.DESC_OBJS_CLASS; // default
try {
if (type.isAnnotation()) {
imageName = JavaPluginImages.DESC_OBJS_ANNOTATION;
} else if (type.isInterface()) {
imageName = JavaPluginImages.DESC_OBJS_INTERFACE;
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
return JavaPluginImages.get(imageName);
}
示例13: accept
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* <p>Subclasses may replace, but usually should not need to. Consider replacing {@linkplain
* #createJavaCompletionProposal(org.eclipse.jdt.core.CompletionProposal)
* createJavaCompletionProposal} instead.
*/
@Override
public void accept(CompletionProposal proposal) {
long start = DEBUG ? System.currentTimeMillis() : 0;
try {
if (isFiltered(proposal)) return;
if (proposal.getKind() == CompletionProposal.POTENTIAL_METHOD_DECLARATION) {
acceptPotentialMethodDeclaration(proposal);
} else {
IJavaCompletionProposal javaProposal = createJavaCompletionProposal(proposal);
if (javaProposal != null) {
fJavaProposals.add(javaProposal);
if (proposal.getKind() == CompletionProposal.KEYWORD) fKeywords.add(javaProposal);
}
}
} catch (IllegalArgumentException e) {
// all signature processing method may throw IAEs
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84657
// don't abort, but log and show all the valid proposals
JavaPlugin.log(
new Status(
IStatus.ERROR,
JavaPlugin.getPluginId(),
IStatus.OK,
"Exception when processing proposal for: " + String.valueOf(proposal.getCompletion()),
e)); // $NON-NLS-1$
}
if (DEBUG) fUITime += System.currentTimeMillis() - start;
}
示例14: canChangeNameAndReturnType
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public boolean canChangeNameAndReturnType() {
try {
return !fMethod.isConstructor();
} catch (JavaModelException e) {
JavaPlugin.log(e);
return false;
}
}
示例15: asFormattedString
import org.eclipse.jdt.internal.ui.JavaPlugin; //导入方法依赖的package包/类
public static String asFormattedString(
ASTNode node, int indent, String lineDelim, Map<String, String> options) {
String unformatted = asString(node);
TextEdit edit = CodeFormatterUtil.format2(node, unformatted, indent, lineDelim, options);
if (edit != null) {
Document document = new Document(unformatted);
try {
edit.apply(document, TextEdit.NONE);
} catch (BadLocationException e) {
JavaPlugin.log(e);
}
return document.get();
}
return unformatted; // unknown node
}