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


Java Util.log方法代码示例

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


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

示例1: refreshReferences

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
public void refreshReferences(IProject source, IProgressMonitor monitor) {
	IProject externalProject = getExternalFoldersProject();
	if (source.equals(externalProject))
		return;
	if (!JavaProject.hasJavaNature(source))
		return;
	try {
		HashSet externalFolders = getExternalFolders(((JavaProject) JavaCore.create(source)).getResolvedClasspath());
		if (externalFolders == null)
			return;
		
		runRefreshJob(externalFolders);
	} catch (CoreException e) {
		Util.log(e, "Exception while refreshing external project"); //$NON-NLS-1$
	}
	return;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:ExternalFoldersManager.java

示例2: getChildren

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
public IJarEntryResource[] getChildren() {
	if (this.resource instanceof IContainer) {
		IResource[] members;
		try {
			members = ((IContainer) this.resource).members();
		} catch (CoreException e) {
			Util.log(e, "Could not retrieve children of " + this.resource.getFullPath()); //$NON-NLS-1$
			return NO_CHILDREN;
		}
		int length = members.length;
		if (length == 0)
			return NO_CHILDREN;
		IJarEntryResource[] children = new IJarEntryResource[length];
		for (int i = 0; i < length; i++) {
			children[i] = new NonJavaResource(this, members[i]);
		}
		return children;
	}
	return NO_CHILDREN;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:NonJavaResource.java

示例3: setSharedProperty

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
/**
 * Record a shared persistent property onto a project.
 * Note that it is orthogonal to IResource persistent properties, and client code has to decide
 * which form of storage to use appropriately. Shared properties produce real resource files which
 * can be shared through a VCM onto a server. Persistent properties are not shareable.
 * <p>
 * Shared properties end up in resource files, and thus cannot be modified during
 * delta notifications (a CoreException would then be thrown).
 *
 * @param key String
 * @param value String
 * @see JavaProject#getSharedProperty(String key)
 * @throws CoreException
 */
public void setSharedProperty(String key, String value) throws CoreException {

	IFile rscFile = this.project.getFile(key);
	byte[] bytes = null;
	try {
		bytes = value.getBytes(org.eclipse.jdt.internal.compiler.util.Util.UTF_8); // .classpath always encoded with UTF-8
	} catch (UnsupportedEncodingException e) {
		Util.log(e, "Could not write .classpath with UTF-8 encoding "); //$NON-NLS-1$
		// fallback to default
		bytes = value.getBytes();
	}
	InputStream inputStream = new ByteArrayInputStream(bytes);
	// update the resource content
	if (rscFile.exists()) {
		if (rscFile.isReadOnly()) {
			// provide opportunity to checkout read-only .classpath file (23984)
			ResourcesPlugin.getWorkspace().validateEdit(new IFile[]{rscFile}, IWorkspace.VALIDATE_PROMPT);
		}
		rscFile.setContents(inputStream, IResource.FORCE, null);
	} else {
		rscFile.create(inputStream, IResource.FORCE, null);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:38,代码来源:JavaProject.java

示例4: setSharedProperty

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
/**
 * Record a shared persistent property onto a project. Note that it is orthogonal to IResource
 * persistent properties, and client code has to decide which form of storage to use
 * appropriately. Shared properties produce real resource files which can be shared through a VCM
 * onto a server. Persistent properties are not shareable.
 *
 * <p>Shared properties end up in resource files, and thus cannot be modified during delta
 * notifications (a CoreException would then be thrown).
 *
 * @param key String
 * @param value String see JavaProject#getSharedProperty(String key)
 * @throws CoreException
 */
public void setSharedProperty(String key, String value) throws CoreException {

  IFile rscFile = this.project.getFile(key);
  byte[] bytes = null;
  try {
    bytes =
        value.getBytes(
            org.eclipse.jdt.internal.compiler.util.Util
                .UTF_8); // .classpath always encoded with UTF-8
  } catch (UnsupportedEncodingException e) {
    Util.log(e, "Could not write .classpath with UTF-8 encoding "); // $NON-NLS-1$
    // fallback to default
    bytes = value.getBytes();
  }
  InputStream inputStream = new ByteArrayInputStream(bytes);
  // update the resource content
  if (rscFile.exists()) {
    //            if (rscFile.isReadOnly()) {
    //                // provide opportunity to checkout read-only .classpath file (23984)
    //                ResourcesPlugin.getWorkspace().validateEdit(new IFile[]{rscFile},
    // IWorkspace.VALIDATE_PROMPT);
    //            }
    rscFile.setContents(inputStream, IResource.FORCE, null);
  } else {
    rscFile.create(inputStream, IResource.FORCE, null);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:41,代码来源:JavaProject.java

示例5: getEnclosingElement

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
public IJavaElement getEnclosingElement() {
	try {
		if (!this.hasComputedEnclosingJavaElements) {
			computeEnclosingJavaElements();
		}
		if (this.compilationUnit == null) return null;
		IJavaElement enclosingElement = this.compilationUnit.getElementAt(this.completionContext.offset);
		return enclosingElement == null ? this.compilationUnit : enclosingElement;
	} catch (JavaModelException e) {
		Util.log(e, "Cannot compute enclosing element"); //$NON-NLS-1$
		return null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:InternalExtendedCompletionContext.java

示例6: refreshReferences

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
public void refreshReferences(final IProject[] sourceProjects, IProgressMonitor monitor) {
	IProject externalProject = getExternalFoldersProject();
	try {
		HashSet externalFolders = null;
		for (int index = 0; index < sourceProjects.length; index++) {
			if (sourceProjects[index].equals(externalProject))
				continue;
			if (!JavaProject.hasJavaNature(sourceProjects[index]))
				continue;

			HashSet foldersInProject = getExternalFolders(((JavaProject) JavaCore.create(sourceProjects[index])).getResolvedClasspath());
			
			if (foldersInProject == null || foldersInProject.size() == 0)
				continue;
			if (externalFolders == null)
				externalFolders = new HashSet();
			
			externalFolders.addAll(foldersInProject);
		}
		if (externalFolders == null) 
			return;

		runRefreshJob(externalFolders);

	} catch (CoreException e) {
		Util.log(e, "Exception while refreshing external project"); //$NON-NLS-1$
	}
	return;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:ExternalFoldersManager.java

示例7: clean

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
protected void clean(IProgressMonitor monitor) throws CoreException {
	this.currentProject = getProject();
	if (this.currentProject == null || !this.currentProject.isAccessible()) return;

	if (DEBUG)
		System.out.println("\nCleaning " + this.currentProject.getName() //$NON-NLS-1$
			+ " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$
	this.notifier = new BuildNotifier(monitor, this.currentProject);
	this.notifier.begin();
	try {
		this.notifier.checkCancel();

		initializeBuilder(CLEAN_BUILD, true);
		if (DEBUG)
			System.out.println("Clearing last state as part of clean : " + this.lastState); //$NON-NLS-1$
		clearLastState();
		removeProblemsAndTasksFor(this.currentProject);
		new BatchImageBuilder(this, false).cleanOutputFolders(false);
	} catch (CoreException e) {
		Util.log(e, "JavaBuilder handling CoreException while cleaning: " + this.currentProject.getName()); //$NON-NLS-1$
		createInconsistentBuildMarker(e);
	} finally {
		this.notifier.done();
		cleanup();
	}
	if (DEBUG)
		System.out.println("Finished cleaning " + this.currentProject.getName() //$NON-NLS-1$
			+ " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:30,代码来源:JavaBuilder.java

示例8: removeUserLibrary

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
public void removeUserLibrary(String libName)  {
	synchronized (this.userLibraries) {
		IEclipsePreferences instancePreferences = JavaModelManager.getJavaModelManager().getInstancePreferences();
		String propertyName = CP_USERLIBRARY_PREFERENCES_PREFIX+libName;
		instancePreferences.remove(propertyName);
		try {
			instancePreferences.flush();
		} catch (BackingStoreException e) {
			Util.log(e, "Exception while removing user library " + libName); //$NON-NLS-1$
		}
	}
	// this.userLibraries was updated during the PreferenceChangeEvent (see preferenceChange(...))
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:UserLibraryManager.java

示例9: clean

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
protected void clean(IProgressMonitor monitor) throws CoreException {
	this.currentProject = getProject();
	if (this.currentProject == null || !this.currentProject.isAccessible()) return;

	if (DEBUG)
		System.out.println("\nJavaBuilder: Cleaning " + this.currentProject.getName() //$NON-NLS-1$
			+ " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$
	this.notifier = new BuildNotifier(monitor, this.currentProject);
	this.notifier.begin();
	try {
		this.notifier.checkCancel();

		initializeBuilder(CLEAN_BUILD, true);
		if (DEBUG)
			System.out.println("JavaBuilder: Clearing last state as part of clean : " + this.lastState); //$NON-NLS-1$
		clearLastState();
		removeProblemsAndTasksFor(this.currentProject);
		new BatchImageBuilder(this, false).cleanOutputFolders(false);
	} catch (CoreException e) {
		Util.log(e, "JavaBuilder handling CoreException while cleaning: " + this.currentProject.getName()); //$NON-NLS-1$
		createInconsistentBuildMarker(e);
	} finally {
		this.notifier.done();
		cleanup();
	}
	if (DEBUG)
		System.out.println("JavaBuilder: Finished cleaning " + this.currentProject.getName() //$NON-NLS-1$
			+ " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:JavaBuilder.java

示例10: getRatioForProperty

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private double getRatioForProperty(String propertyName) {
	String property = System.getProperty(propertyName);
	if (property != null) {
		try {
			return Double.parseDouble(property);
		} catch (NumberFormatException e) {
			// ignore
			Util.log(e, "Could not parse value for " + propertyName + ": " + property); //$NON-NLS-1$ //$NON-NLS-2$
		}
	}
	return 1.0;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:13,代码来源:JavaModelCache.java

示例11: getParameterTypes

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
/**
 * @see IMethodBinding#getParameterTypes()
 */
public ITypeBinding[] getParameterTypes() {
	if (this.parameterTypes != null) {
		return this.parameterTypes;
	}
	org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] parameters = this.binding.parameters;
	int length = parameters == null ? 0 : parameters.length;
	if (length == 0) {
		return this.parameterTypes = NO_TYPE_BINDINGS;
	} else {
		ITypeBinding[] paramTypes = new ITypeBinding[length];
		for (int i = 0; i < length; i++) {
			final TypeBinding parameterBinding = parameters[i];
			if (parameterBinding != null) {
				ITypeBinding typeBinding = this.resolver.getTypeBinding(parameterBinding);
				if (typeBinding == null) {
					return this.parameterTypes = NO_TYPE_BINDINGS;
				}
				paramTypes[i] = typeBinding;
			} else {
				// log error
				StringBuffer message = new StringBuffer("Report method binding where a parameter is null:\n");  //$NON-NLS-1$
				message.append(toString());
				Util.log(new IllegalArgumentException(), message.toString());
				// report no binding since one or more parameter has no binding
				return this.parameterTypes = NO_TYPE_BINDINGS;
			}
		}
		return this.parameterTypes = paramTypes;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:MethodBinding.java

示例12: getFolders

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private Map getFolders() {
	if (this.folders == null) {
		Map tempFolders = new HashMap();
		IProject project = getExternalFoldersProject();
		try {
			if (!project.isAccessible()) {
				if (project.exists()) {
					// workspace was moved (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=252571 )
					openExternalFoldersProject(project, null/*no progress*/);
				} else {
					// if project doesn't exist, do not open and recreate it as it means that there are no external folders
					return this.folders = Collections.synchronizedMap(tempFolders);
				}
			}
			IResource[] members = project.members();
			for (int i = 0, length = members.length; i < length; i++) {
				IResource member = members[i];
				if (member.getType() == IResource.FOLDER && member.isLinked() && member.getName().startsWith(LINKED_FOLDER_NAME)) {
					IPath externalFolderPath = member.getLocation();
					tempFolders.put(externalFolderPath, member);
				}
			}
		} catch (CoreException e) {
			Util.log(e, "Exception while initializing external folders"); //$NON-NLS-1$
		}
		this.folders = Collections.synchronizedMap(tempFolders);
	}
	return this.folders;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:30,代码来源:ExternalFoldersManager.java

示例13: readFileEntriesWithException

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
/**
 * Reads the classpath file entries of this project's .classpath file. Returns a two-dimensional
 * array, where the number of elements in the row is fixed to 2. The first element is an array of
 * raw classpath entries, which includes the output entry, and the second element is an array of
 * referenced entries that may have been stored by the client earlier. See {@link
 * IJavaProject#getReferencedClasspathEntries()} for more details. As a side effect, unknown
 * elements are stored in the given map (if not null) Throws exceptions if the file cannot be
 * accessed or is malformed.
 */
public IClasspathEntry[][] readFileEntriesWithException(Map unknownElements)
    throws CoreException, IOException, ClasspathEntry.AssertionFailedException {
  IFile rscFile =
      this.project.getFile(org.eclipse.jdt.internal.core.JavaProject.CLASSPATH_FILENAME);
  byte[] bytes;
  if (rscFile.exists()) {
    bytes = Util.getResourceContentsAsByteArray(rscFile);
  } else {
    // when a project is imported, we get a first delta for the addition of the .project, but the
    // .classpath is not accessible
    // so default to using java.io.File
    // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96258

    // TODO: keep this comment code for the history
    // TODO: this is original Eclipse code
    //            URI location = rscFile.getLocationURI();
    //            if (location == null)
    //            throw new IOException("Cannot obtain a location URI for " + rscFile);
    // //$NON-NLS-1$
    //            File file = Util.toLocalFile(location, null/*no progress monitor available*/);
    //            if (file == null)
    //                throw new IOException("Unable to fetch file from " + location);
    // //$NON-NLS-1$
    //            try {
    //                bytes =
    // org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(file);
    //            } catch (IOException e) {
    //                if (!file.exists())
    return new IClasspathEntry[][] {defaultClasspath(), ClasspathEntry.NO_ENTRIES};
    //                throw e;
    //            }
  }
  if (hasUTF8BOM(bytes)) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=240034
    int length = bytes.length - IContentDescription.BOM_UTF_8.length;
    System.arraycopy(
        bytes, IContentDescription.BOM_UTF_8.length, bytes = new byte[length], 0, length);
  }
  String xmlClasspath;
  try {
    xmlClasspath =
        new String(
            bytes,
            org.eclipse.jdt.internal.compiler.util.Util
                .UTF_8); // .classpath always encoded with UTF-8
  } catch (UnsupportedEncodingException e) {
    Util.log(e, "Could not read .classpath with UTF-8 encoding"); // $NON-NLS-1$
    // fallback to default
    xmlClasspath = new String(bytes);
  }
  return decodeClasspath(xmlClasspath, unknownElements);
}
 
开发者ID:eclipse,项目名称:che,代码行数:61,代码来源:JavaProject.java

示例14: createAnnotationProcessorManager

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
public AbstractAnnotationProcessorManager createAnnotationProcessorManager() {
	synchronized(this) {
		if (this.annotationProcessorManagerFactory == null) {
			IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID);
			if (extension == null)
				return null;
			IExtension[] extensions = extension.getExtensions();
			for(int i = 0; i < extensions.length; i++) {
				if (i > 0) {
					Util.log(null, "An annotation processor manager is already registered: ignoring " + extensions[i].getUniqueIdentifier()); //$NON-NLS-1$
					break;
				}
				IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
				for(int j = 0; j < configElements.length; j++) {
					final IConfigurationElement configElement = configElements[j];
					if ("annotationProcessorManager".equals(configElement.getName())) { //$NON-NLS-1$
						this.annotationProcessorManagerFactory = configElement;
						break;
					}
				}
			}
		}
	}

	if (this.annotationProcessorManagerFactory == null) {
		return null;
	}
	final AbstractAnnotationProcessorManager[] apm = new AbstractAnnotationProcessorManager[1];
	apm[0] = null;
	final IConfigurationElement factory = this.annotationProcessorManagerFactory;
	SafeRunner.run(new ISafeRunnable() {
		public void handleException(Throwable exception) {
			Util.log(exception, "Exception occurred while loading annotation processor manager"); //$NON-NLS-1$
		}
		public void run() throws Exception {
			Object executableExtension = factory.createExecutableExtension("class"); //$NON-NLS-1$
			if (executableExtension instanceof AbstractAnnotationProcessorManager) {
				apm[0] = (AbstractAnnotationProcessorManager) executableExtension;
			}
		}
	});
	return apm[0];
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:44,代码来源:JavaModelManager.java

示例15: recreatePersistedContainer

import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private static void recreatePersistedContainer(final IJavaProject project, final IPath containerPath, String containerString, boolean addToContainerValues) {
	if (!project.getProject().isAccessible()) return; // avoid leaking deleted project's persisted container
	if (containerString == null) {
		getJavaModelManager().containerPut(project, containerPath, null);
	} else {
		IClasspathEntry[] entries;
		try {
			entries = ((JavaProject) project).decodeClasspath(containerString, null/*not interested in unknown elements*/)[0];
		} catch (IOException e) {
			Util.log(e, "Could not recreate persisted container: \n" + containerString); //$NON-NLS-1$
			entries = JavaProject.INVALID_CLASSPATH;
		}
		if (entries != JavaProject.INVALID_CLASSPATH) {
			final IClasspathEntry[] containerEntries = entries;
			IClasspathContainer container = new IClasspathContainer() {
				public IClasspathEntry[] getClasspathEntries() {
					return containerEntries;
				}
				public String getDescription() {
					return "Persisted container ["+containerPath+" for project ["+ project.getElementName()+"]"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
				}
				public int getKind() {
					return 0;
				}
				public IPath getPath() {
					return containerPath;
				}
				public String toString() {
					return getDescription();
				}

			};
			if (addToContainerValues) {
				getJavaModelManager().containerPut(project, containerPath, container);
			}
			Map projectContainers = (Map)getJavaModelManager().previousSessionContainers.get(project);
			if (projectContainers == null){
				projectContainers = new HashMap(1);
				getJavaModelManager().previousSessionContainers.put(project, projectContainers);
			}
			projectContainers.put(containerPath, container);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:45,代码来源:JavaModelManager.java


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