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


Java JarPackageData.getManifestMainClass方法代码示例

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


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

示例1: isMainClassValid

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入方法依赖的package包/类
/**
 * Tells whether the specified manifest main class is valid.
 * 
 * @param data the Jar package data
 * @param context the runnable context
 * @return <code>true</code> if a main class is specified and valid
 */
public static boolean isMainClassValid(JarPackageData data, IRunnableContext context) {
	if (data == null)
		return false;

	IType mainClass= data.getManifestMainClass();
	if (mainClass == null)
		// no main class specified
		return true;

	try {
		// Check if main method is in scope
		IFile file= (IFile)mainClass.getResource();
		if (file == null || !contains(asResources(data.getElements()), file))
			return false;

		// Test if it has a main method
		return JavaModelUtil.hasMainMethod(mainClass);
	} catch (JavaModelException e) {
		JavaPlugin.log(e.getStatus());
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:JarPackagerUtil.java

示例2: getMainClassName

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入方法依赖的package包/类
/**
 * Gets the name of the manifest's main class
 * 
 * @param jarPackage the Jar package data
 * @return a string with the name
 */
static String getMainClassName(JarPackageData jarPackage) {
	if (jarPackage.getManifestMainClass() == null)
		return ""; //$NON-NLS-1$
	else
		return jarPackage.getManifestMainClass().getFullyQualifiedName();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:JarPackagerUtil.java

示例3: xmlWriteManifest

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入方法依赖的package包/类
private void xmlWriteManifest(JarPackageData jarPackage, Document document, Element xmlJarDesc) throws DOMException {
	Element manifest= document.createElement("manifest"); //$NON-NLS-1$
	xmlJarDesc.appendChild(manifest);
	manifest.setAttribute("manifestVersion", jarPackage.getManifestVersion()); //$NON-NLS-1$
	manifest.setAttribute("usesManifest", "" + jarPackage.usesManifest()); //$NON-NLS-2$ //$NON-NLS-1$
	manifest.setAttribute("reuseManifest", "" + jarPackage.isManifestReused()); //$NON-NLS-2$ //$NON-NLS-1$
	manifest.setAttribute("saveManifest", "" + jarPackage.isManifestSaved()); //$NON-NLS-2$ //$NON-NLS-1$
	manifest.setAttribute("generateManifest", "" + jarPackage.isManifestGenerated()); //$NON-NLS-2$ //$NON-NLS-1$
	manifest.setAttribute("manifestLocation", jarPackage.getManifestLocation().toPortableString()); //$NON-NLS-1$
	if (jarPackage.getManifestMainClass() != null)
		manifest.setAttribute("mainClassHandleIdentifier", jarPackage.getManifestMainClass().getHandleIdentifier()); //$NON-NLS-1$
	xmlWriteSealingInfo(jarPackage, document, manifest);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:JarPackageWriter.java

示例4: putMainClass

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入方法依赖的package包/类
private void putMainClass(Manifest manifest, JarPackageData jarPackage) {
	if (jarPackage.getManifestMainClass() != null && jarPackage.getManifestMainClass().getFullyQualifiedName().length() > 0)
		manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, jarPackage.getManifestMainClass().getFullyQualifiedName());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:ManifestProvider.java

示例5: putMainClass

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入方法依赖的package包/类
private void putMainClass(Manifest manifest, JarPackageData jarPackage) {
	if (jarPackage.getManifestMainClass() != null && jarPackage.getManifestMainClass().getFullyQualifiedName().length() > 0) {
		manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, JIJConstants.LOADER_MAIN_CLASS);
		manifest.getMainAttributes().putValue(JIJConstants.REDIRECTED_MAIN_CLASS_MANIFEST_NAME, jarPackage.getManifestMainClass().getFullyQualifiedName());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:FatJarRsrcUrlManifestProvider.java


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