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


Java JarPackageData类代码示例

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


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

示例1: xmlReadSealingInfo

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private void xmlReadSealingInfo(JarPackageData jarPackage, Element element) throws java.io.IOException {
	/*
	 * Try to find sealing info. Could ask for single child node
	 * but this would stop others from adding more child nodes to
	 * the manifest node.
	 */
	NodeList sealingElementContainer= element.getChildNodes();
	for (int j= 0; j < sealingElementContainer.getLength(); j++) {
		Node sealingNode= sealingElementContainer.item(j);
		if (sealingNode.getNodeType() == Node.ELEMENT_NODE
			&& sealingNode.getNodeName().equals("sealing")) { //$NON-NLS-1$
			// Sealing
			Element sealingElement= (Element)sealingNode;
			jarPackage.setSealJar(getBooleanAttribute(sealingElement, "sealJar")); //$NON-NLS-1$
			jarPackage.setPackagesToSeal(getPackages(sealingElement.getElementsByTagName("packagesToSeal"))); //$NON-NLS-1$
			jarPackage.setPackagesToUnseal(getPackages(sealingElement.getElementsByTagName("packagesToUnSeal"))); //$NON-NLS-1$
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:JarPackageReader.java

示例2: xmlReadSelectedElements

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private void xmlReadSelectedElements(JarPackageData jarPackage, Element element) throws java.io.IOException {
	if (element.getNodeName().equals("selectedElements")) { //$NON-NLS-1$
		jarPackage.setExportClassFiles(getBooleanAttribute(element, "exportClassFiles")); //$NON-NLS-1$
		jarPackage.setExportOutputFolders(getBooleanAttribute(element, "exportOutputFolder", false)); //$NON-NLS-1$
		jarPackage.setExportJavaFiles(getBooleanAttribute(element, "exportJavaFiles")); //$NON-NLS-1$
		NodeList selectedElements= element.getChildNodes();
		Set<IAdaptable> elementsToExport= new HashSet<IAdaptable>(selectedElements.getLength());
		for (int j= 0; j < selectedElements.getLength(); j++) {
			Node selectedNode= selectedElements.item(j);
			if (selectedNode.getNodeType() != Node.ELEMENT_NODE)
				continue;
			Element selectedElement= (Element)selectedNode;
			if (selectedElement.getNodeName().equals("file")) //$NON-NLS-1$
				addFile(elementsToExport, selectedElement);
			else if (selectedElement.getNodeName().equals("folder")) //$NON-NLS-1$
				addFolder(elementsToExport,selectedElement);
			else if (selectedElement.getNodeName().equals("project")) //$NON-NLS-1$
				addProject(elementsToExport ,selectedElement);
			else if (selectedElement.getNodeName().equals("javaElement")) //$NON-NLS-1$
				addJavaElement(elementsToExport, selectedElement);
			// Note: Other file types are not handled by this writer
		}
		jarPackage.setElements(elementsToExport.toArray());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:JarPackageReader.java

示例3: export

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private IStatus export(JarPackageData[] jarPackages) {
	Shell shell= getShell();
	IJarExportRunnable op= jarPackages[0].createJarExportRunnable(jarPackages, shell);
	try {
		PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(false, true, op);
		//PlatformUI.getWorkbench().getProgressService().run(false, true, op); // see bug 118152
	} catch (InvocationTargetException ex) {
		if (ex.getTargetException() != null) {
			ExceptionHandler.handle(ex, shell, JarPackagerMessages.CreateJarActionDelegate_jarExportError_title, JarPackagerMessages.CreateJarActionDelegate_jarExportError_message);
			return null;
		}
	} catch (InterruptedException e) {
		// do nothing on cancel
		return null;
	}
	return op.getStatus();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:CreateJarActionDelegate.java

示例4: 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

示例5: xmlWriteSelectedElements

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private void xmlWriteSelectedElements(JarPackageData jarPackage, Document document, Element xmlJarDesc) throws DOMException {
	Element selectedElements= document.createElement("selectedElements"); //$NON-NLS-1$
	xmlJarDesc.appendChild(selectedElements);
	selectedElements.setAttribute("exportClassFiles", "" + jarPackage.areClassFilesExported()); //$NON-NLS-2$ //$NON-NLS-1$
	selectedElements.setAttribute("exportOutputFolder", "" + jarPackage.areOutputFoldersExported()); //$NON-NLS-2$ //$NON-NLS-1$
	selectedElements.setAttribute("exportJavaFiles", "" + jarPackage.areJavaFilesExported()); //$NON-NLS-2$ //$NON-NLS-1$
	Object[] elements= jarPackage.getElements();
	for (int i= 0; i < elements.length; i++) {
		Object element= elements[i];
		if (element instanceof IResource)
			add((IResource)element, selectedElements, document);
		else if (element instanceof IJavaElement)
			add((IJavaElement)element, selectedElements, document);
		// Note: Other file types are not handled by this writer
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:JarPackageWriter.java

示例6: getSelectedElementsWithoutContainedChildren

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
public static Object[] getSelectedElementsWithoutContainedChildren(ILaunchConfiguration launchconfig, JarPackageData data, IRunnableContext context, MultiStatus status) throws CoreException {
	if (launchconfig == null)
		return new Object[0];

	String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$

	IPath[] classpath= getClasspath(launchconfig);
	IPackageFragmentRoot[] classpathResources= getRequiredPackageFragmentRoots(classpath, projectName, status);

	String mainClass= getMainClass(launchconfig, status);
	IType mainType= findMainMethodByName(mainClass, classpathResources, context);
	if (mainType == null) {
		status.add(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_error_noMainMethod));
	}
	data.setManifestMainClass(mainType);

	return classpathResources;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:FatJarPackageWizardPage.java

示例7: getJarPackageData

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
protected JarPackageData getJarPackageData(IPackageFragmentRoot[] roots, IType mainType, IProgressMonitor monitor)
		throws CoreException {

	String filePath = getTempJarPath(appModule.getLocalModule());

	if (filePath == null) {
		errorHandler.handleApplicationDeploymentFailure("Failed to create temporary JAR file");
	}

	IPath location = new Path(filePath);

	// Note that if no jar builder is specified in the package data
	// then a default one is used internally by the data that does NOT
	// package any jar dependencies.
	JarPackageData packageData = new JarPackageData();

	packageData.setJarLocation(location);

	// Don't create a manifest. A repackager should determine if a
	// generated
	// manifest is necessary
	// or use a user-defined manifest.
	packageData.setGenerateManifest(false);

	// Since user manifest is not used, do not save to manifest (save to
	// manifest saves to user defined manifest)
	packageData.setSaveManifest(false);

	packageData.setManifestMainClass(mainType);
	packageData.setElements(roots);
	return packageData;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:33,代码来源:JarArchivingUIHandler.java

示例8: readXML

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
public JarPackageData readXML(JarPackageData jarPackage) throws IOException, SAXException {
  	DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
   	factory.setValidating(false);
	DocumentBuilder parser= null;

	try {
		parser= factory.newDocumentBuilder();
	} catch (ParserConfigurationException ex) {
		throw new IOException(ex.getLocalizedMessage());
	} finally {
		// Note: Above code is OK since clients are responsible to close the stream
	}
	parser.setErrorHandler(new DefaultHandler());
	Element xmlJarDesc= parser.parse(new InputSource(fInputStream)).getDocumentElement();
	if (!xmlJarDesc.getNodeName().equals(JarPackagerUtil.DESCRIPTION_EXTENSION)) {
		throw new IOException(JarPackagerMessages.JarPackageReader_error_badFormat);
	}
	NodeList topLevelElements= xmlJarDesc.getChildNodes();
	for (int i= 0; i < topLevelElements.getLength(); i++) {
		Node node= topLevelElements.item(i);
		if (node.getNodeType() != Node.ELEMENT_NODE)
			continue;
		Element element= (Element)node;
		xmlReadJarLocation(jarPackage, element);
		xmlReadOptions(jarPackage, element);
		xmlReadRefactoring(jarPackage, element);
		xmlReadSelectedProjects(jarPackage, element);
		if (jarPackage.areGeneratedFilesExported())
			xmlReadManifest(jarPackage, element);
		xmlReadSelectedElements(jarPackage, element);
	}
	return jarPackage;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:JarPackageReader.java

示例9: xmlReadManifest

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private void xmlReadManifest(JarPackageData jarPackage, Element element) throws java.io.IOException {
	if (element.getNodeName().equals("manifest")) { //$NON-NLS-1$
		jarPackage.setManifestVersion(element.getAttribute("manifestVersion")); //$NON-NLS-1$
		jarPackage.setUsesManifest(getBooleanAttribute(element, "usesManifest")); //$NON-NLS-1$
		jarPackage.setReuseManifest(getBooleanAttribute(element, "reuseManifest")); //$NON-NLS-1$
		jarPackage.setSaveManifest(getBooleanAttribute(element,"saveManifest")); //$NON-NLS-1$
		jarPackage.setGenerateManifest(getBooleanAttribute(element, "generateManifest")); //$NON-NLS-1$
		jarPackage.setManifestLocation(Path.fromPortableString(element.getAttribute("manifestLocation"))); //$NON-NLS-1$
		jarPackage.setManifestMainClass(getMainClass(element));
		xmlReadSealingInfo(jarPackage, element);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:JarPackageReader.java

示例10: xmlReadSelectedProjects

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private void xmlReadSelectedProjects(JarPackageData jarPackage, Element element) throws java.io.IOException {
	if (element.getNodeName().equals("selectedProjects")) { //$NON-NLS-1$
		NodeList selectedElements= element.getChildNodes();
		Set<IAdaptable> selectedProjects= new HashSet<IAdaptable>(selectedElements.getLength());
		for (int index= 0; index < selectedElements.getLength(); index++) {
			Node node= selectedElements.item(index);
			if (node.getNodeType() != Node.ELEMENT_NODE)
				continue;
			Element selectedElement= (Element)node;
			if (selectedElement.getNodeName().equals("project")) //$NON-NLS-1$
				addProject(selectedProjects ,selectedElement);
		}
		jarPackage.setRefactoringProjects(selectedProjects.toArray(new IProject[selectedProjects.size()]));
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:JarPackageReader.java

示例11: readJarPackages

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private JarPackageData[] readJarPackages(IFile[] descriptions, MultiStatus readStatus) {
	List<JarPackageData> jarPackagesList= new ArrayList<JarPackageData>(descriptions.length);
	for (int i= 0; i < descriptions.length; i++) {
		JarPackageData jarPackage= readJarPackage(descriptions[i], readStatus);
		if (jarPackage != null)
			jarPackagesList.add(jarPackage);
	}
	return jarPackagesList.toArray(new JarPackageData[jarPackagesList.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:CreateJarActionDelegate.java

示例12: init

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void init(IWorkbench workbench, IStructuredSelection selection) {
	// ignore the selection argument since the main export wizard changed it
	fSelection= getValidSelection();
	fJarPackage= new JarPackageData();
	setInitializeFromJarPackage(false);
	setWindowTitle(JarPackagerMessages.JarPackageWizard_windowTitle);
	setDefaultPageImageDescriptor(JavaPluginImages.DESC_WIZBAN_JAR_PACKAGER);
	setNeedsProgressMonitor(true);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:JarPackageWizard.java

示例13: create

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
/**
 * Creates a manifest as defined by the <code>JarPackage</code>.
 *
 * @param	jarPackage	the JAR package specification
 * @return the manifest
 * @throws CoreException
 */
public Manifest create(JarPackageData jarPackage) throws CoreException {
	Assert.isNotNull(jarPackage);
	if (jarPackage.isManifestGenerated())
		return createGeneratedManifest(jarPackage);

	try {
		return createSuppliedManifest(jarPackage);
	} catch (IOException ex) {
		throw JarPackagerUtil.createCoreException(ex.getLocalizedMessage(), ex);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ManifestProvider.java

示例14: createGeneratedManifest

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private Manifest createGeneratedManifest(JarPackageData jarPackage) {
	Manifest manifest= new Manifest();
	putVersion(manifest, jarPackage);
	putSealing(manifest, jarPackage);
	putMainClass(manifest, jarPackage);
	putAdditionalEntries(manifest, jarPackage);
	return manifest;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:ManifestProvider.java

示例15: createSuppliedManifest

import org.eclipse.jdt.ui.jarpackager.JarPackageData; //导入依赖的package包/类
private Manifest createSuppliedManifest(JarPackageData jarPackage) throws CoreException, IOException {
	Manifest manifest;
	// No need to use buffer here because Manifest(...) does
	InputStream stream= jarPackage.getManifestFile().getContents(false);
	try {
		manifest= new Manifest(stream);
	} finally {
		if (stream != null)
			stream.close();
	}
	return manifest;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:ManifestProvider.java


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