j2meclasspathcontainerinitializer.java

来自「配置文件」· Java 代码 · 共 58 行

JAVA
58
字号
package eclipseme.core.internal;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ClasspathContainerInitializer;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;

/**
 * An initializer to fill in a J2MEClasspathContainer.
 * <p>
 * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
 * change before reaching stability. It is being made available at this early stage to solicit feedback
 * from pioneering adopters on the understanding that any code that uses this API will almost 
 * certainly be broken as the API evolves.
 * </p>
 * Copyright (c) 2003-2005 Craig Setera<br>
 * All Rights Reserved.<br>
 * Licensed under the Eclipse Public License - v 1.0<p/>
 * <br>
 * $Revision: 1.4 $
 * <br>
 * $Date: 2006/02/11 21:26:57 $
 * <br>
 * @author Yang Liu
 * @author Craig Setera
 * 
 * @see eclipseme.core.internal.J2MEClasspathContainer
 */
public class J2MEClasspathContainerInitializer extends ClasspathContainerInitializer 
{
	/**
	 *  Construct a new classpath container intializer for J2ME libraries.
	 */
	public J2MEClasspathContainerInitializer() {
		super();
	}

	/**
	 * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)
	 */
	public void initialize(IPath containerPath, IJavaProject project)
			throws CoreException 
	{
		int size = containerPath.segmentCount();

		if (size > 0) {
			if (containerPath.segment(0).equals(J2MEClasspathContainer.J2ME_CONTAINER)) {
				IJavaProject[] projects = new IJavaProject[] { project }; 
				IClasspathContainer[] containers = 
					new IClasspathContainer[] { new J2MEClasspathContainer(project, containerPath) };
				JavaCore.setClasspathContainer(containerPath, projects, containers, null);
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?