⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 v003to005migrator.java

📁 eclipseme的最新版本的source,欢迎j2me程序员使用
💻 JAVA
字号:
/**
 * Copyright (c) 2003-2005 Craig Setera
 * All Rights Reserved.
 * Licensed under the Eclipse Public License - v 1.0
 * For more information see http://www.eclipse.org/legal/epl-v10.html
 */
package eclipseme.core.internal.migration;

import org.eclipse.core.resources.IWorkspaceRoot;

/**
 * Helper class for doing migration of the changes between
 * version 0.0.3 and 0.0.5.
 * <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.5 $
 * <br>
 * $Date: 2005/07/07 02:37:17 $
 * <br>
 * @author Craig Setera
 */

public class V003To005Migrator {
	private static final String[] ORIGINAL_DEFS = new String[] {
		"Generic MIDP-1.0 Platform",
		"Generic MIDP-2.0 Platform",
	};
	
	private static final String[] NEW_DEFS = new String[] {
		"J2ME Wireless Toolkit 1.0.4 Platform",
		"J2ME Wireless Toolkit 2.0 Platform",
	};

	/**
	 * 
	 * @uml.property name="workspaceRoot"
	 * @uml.associationEnd 
	 * @uml.property name="workspaceRoot" multiplicity="(1 1)"
	 */
	// The root of the workspace that allows us to look through projects
	private IWorkspaceRoot workspaceRoot;
//
//	
//	/**
//	 * Construct a new migration helper.
//	 * 
//	 * @param workspaceRoot
//	 */
//	public V003To005Migrator(IWorkspaceRoot workspaceRoot) {
//		super();
//		this.workspaceRoot = workspaceRoot;
//	}
//	
//	/**
//	 * Do the work of this migration.
//	 * 
//	 * @throws CoreException
//	 */
//	public void doMigration() 
//		throws CoreException
//	{
//		IProject[] projects = workspaceRoot.getProjects();
//		for (int i = 0; i < projects.length; i++) {
//			if (projects[i].isOpen() && J2MENature.hasJ2MENature(projects[i])) {
//				migrateProjectPlatformDefinition(projects[i]);
//			}
//		}
//	}
//
//	/**
//	 * Get the mapped platform definition name or <code>null</code>
//	 * if no such mapping exists.
//	 * 
//	 * @param platformDefName
//	 * @return
//	 */
//	private String getMappedName(String platformDefName) {
//		String mapped = null;
//		
//		for (int i = 0; i < ORIGINAL_DEFS.length; i++) {
//			if (ORIGINAL_DEFS[i].equals(platformDefName)) {
//				mapped = NEW_DEFS[i];
//				break;
//			}
//			
//		}
//
//		return mapped;
//	}
//
//	/**
//	 * Get the components registry.
//	 * 
//	 * @return
//	 */
//	private PlatformComponentRegistry getRegistry() {
//		return PlatformComponentRegistry.getInstance();
//	}
//
//	/**
//	 * Migrate the specified midlet suite project.  It is assumed
//	 * this object is not <code>null</code>.
//	 * 
//	 * @param suite
//	 * @throws CoreException
//	 */
//	private void migrateMidletSuiteProject(IMidletSuiteProject suite)
//		throws CoreException {
//		String platformDefName = suite.getPlatformDefinitionName();
//		if (!platformDefinitionExists(platformDefName)) {
//			String mapped = getMappedName(platformDefName);
//			
//			if (mapped != null) {
//				IPlatformDefinition def =
//					getRegistry().getPlatformDefinition(mapped);
//				if (def != null) {
//					 suite.setPlatformDefinition(def);
//				}
//			}
//		}
//	}
//
//	/**
//	 * Migrate the well-known platform definition names for the
//	 * specified project. 
//	 * 
//	 * @param project
//	 * @throws CoreException
//	 */
//	private void migrateProjectPlatformDefinition(IProject project)
//		throws CoreException 
//	{
//		IJavaProject javaProject = JavaCore.create(project);
//		if (javaProject != null) {
//			IMidletSuiteProject suite = 
//				MidletSuiteProject.getMidletSuiteProject(javaProject);
//
//			if (suite != null) {
//				migrateMidletSuiteProject(suite);
//			}
//		}
//	}
//
//	/**
//	 * Check if the specified platform definition exists in the registry.
//	 * 
//	 * @param platformDefName
//	 * @return
//	 */
//	private boolean platformDefinitionExists(String platformDefName) {
//		IPlatformDefinition def =
//			getRegistry().getPlatformDefinition(platformDefName);
//			
//		return (def != null);
//	}
}

⌨️ 快捷键说明

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