本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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());
}
示例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());
}
}