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


Java IJavaProject.close方法代码示例

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


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

示例1: getIPackageFragment

import org.eclipse.jdt.core.IJavaProject; //导入方法依赖的package包/类
/**
 * Returns packages of given jar file
 * 
 * @param jarFileName
 * @return IPackageFragmentRoot
 * 			packages of given jar file
 */
public IPackageFragmentRoot getIPackageFragment(String jarFileName) {
	IProject iProject = getCurrentProject();
	IJavaProject javaProject = JavaCore.create(iProject);
	try {
		if(StringUtils.equals(jarFileName, hydrograph.ui.common.util.Constants.ProjectSupport_SRC)){
			return getSrcPackageFragment(javaProject);
		}
		
		IPackageFragmentRoot[] fragmentRoot = javaProject.getAllPackageFragmentRoots();
		for (IPackageFragmentRoot iPackageFragmentRoot : fragmentRoot) {
			if (StringUtils.contains(iPackageFragmentRoot.getElementName(), jarFileName))
				return iPackageFragmentRoot;
		}
	} catch (JavaModelException javaModelException) {
		LOGGER.error("Error occurred while loading engines-transform jar", javaModelException);
	}
	finally{
		if(javaProject!=null){
			try {
				javaProject.close();
			} catch (JavaModelException modelException) {
				LOGGER.warn("JavaModelException occurred while closing java-project"+modelException);
			}
		}
	}
	if(StringUtils.equals(jarFileName, ConfigFileReader.INSTANCE.getConfigurationValueFromCommon(Constants.KEY_TRANSFORMATION_JAR)))
		new CustomMessageBox(SWT.ERROR, "Error occurred while loading " + jarFileName + " file", "ERROR").open();
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:37,代码来源:BuildExpressionEditorDataSturcture.java

示例2: loadComboJarListFromBuildPath

import org.eclipse.jdt.core.IJavaProject; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
private void loadComboJarListFromBuildPath(Combo comboJarList, String newJarName) {
	comboJarList.removeAll();
	IProject iProject = BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject();
	IJavaProject iJavaProject=null;
	try {
		iJavaProject = JavaCore.create(iProject);
		PackageFragmentRoot srcfragmentRoot= BuildExpressionEditorDataSturcture.INSTANCE.getSrcPackageFragment(iJavaProject);
		comboJarList.add(hydrograph.ui.common.util.Constants.ProjectSupport_SRC);
		comboJarList.setData(String.valueOf(comboJarList.getItemCount() - 1), srcfragmentRoot);
		
		for (IPackageFragmentRoot iPackageFragmentRoot : iJavaProject.getAllPackageFragmentRoots()) {
			if (isJarPresentInLibFolder(iPackageFragmentRoot.getPath())
					&& iPackageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) {
				comboJarList.add(iPackageFragmentRoot.getElementName());
				comboJarList.setData(String.valueOf(comboJarList.getItemCount() - 1), iPackageFragmentRoot);
			}
		}
		selectAndLoadJarData(newJarName);
	} catch (JavaModelException javaModelException) {
		LOGGER.error("Error occurred while loading engines-transform jar", javaModelException);
	}
	finally{
		if(iJavaProject!=null){
			try {
				iJavaProject.close();
			} catch (JavaModelException e) {
				LOGGER.warn("JavaModelException occurred while closing java-project"+e);
			}
		}
	}

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:34,代码来源:CategoriesDialogSourceComposite.java

示例3: getFiles

import org.eclipse.jdt.core.IJavaProject; //导入方法依赖的package包/类
private static Set<ICompilationUnit> getFiles(String projname) throws CoreException {
	IWorkspaceRoot ws = ResourcesPlugin.getWorkspace().getRoot();
	IProject proj = ws.getProject(projname);
	IJavaProject javaProject = JavaCore.create(proj);
	Set<ICompilationUnit> files = new HashSet<ICompilationUnit>();
	javaProject.open(new NullProgressMonitor());
	for( IPackageFragment packFrag : javaProject.getPackageFragments()) {
		for (ICompilationUnit icu : packFrag.getCompilationUnits()) {
			files.add(icu);
		}
	}
	javaProject.close();
	return files;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:15,代码来源:LSDiffRunner.java

示例4: SourceViewer

import org.eclipse.jdt.core.IJavaProject; //导入方法依赖的package包/类
public SourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
		boolean showAnnotationsOverview, int styles, IAnnotationAccess annotationAccess, ISharedTextColors sharedColors,
		IDocument document) 
{
	super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, SWT.BOLD);
	int id = currentId++;
	filename = VIEWER_CLASS_NAME + id++ + ".java";
	this.sharedColors=sharedColors;
	this.annotationAccess=annotationAccess;
	this.fOverviewRuler=overviewRuler;
	oldAnnotations= new HashMap<ProjectionAnnotation, Position>();

	IJavaProject javaProject = JavaCore.create(BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject());
	try 
	{
		IPackageFragmentRoot[] ipackageFragmentRootList=javaProject.getPackageFragmentRoots();
		IPackageFragmentRoot ipackageFragmentRoot=null;
		for(IPackageFragmentRoot tempIpackageFragmentRoot:ipackageFragmentRootList)
		{
			if(tempIpackageFragmentRoot.getKind()==IPackageFragmentRoot.K_SOURCE 
					&& StringUtils.equals(PathConstant.TEMP_BUILD_PATH_SETTINGS_FOLDER,tempIpackageFragmentRoot.getPath().removeFirstSegments(1).toString()))
			{
				ipackageFragmentRoot=tempIpackageFragmentRoot;
				break;
			}   
		} 

		IPackageFragment compilationUnitPackage=   ipackageFragmentRoot.createPackageFragment(HYDROGRAPH_COMPILATIONUNIT_PACKAGE, true, new NullProgressMonitor());
		compilatioUnit=   compilationUnitPackage.createCompilationUnit(filename,document.get(),true, new NullProgressMonitor());
	} 
	catch (Exception exception) {
		LOGGER.warn("Exception occurred while initializing source viewer", exception);
	} finally {
		if (javaProject != null) {
			try {
				javaProject.close();
			} catch (JavaModelException javaModelException) {
				LOGGER.warn("Exception occurred while closing java-project", javaModelException);
			}
		}
	}
	initializeViewer(document);
	updateContents();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:45,代码来源:SourceViewer.java

示例5: getBuildPathForMethodInvocation

import org.eclipse.jdt.core.IJavaProject; //导入方法依赖的package包/类
public static Object[] getBuildPathForMethodInvocation() throws JavaModelException, MalformedURLException {
	String transfromJarPath = null;
	Object[] returnObj=new Object[3];
	IJavaProject iJavaProject = JavaCore.create(BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject());
	List<URL> urlList = new ArrayList<>();
	Properties properties = ConfigFileReader.INSTANCE.getCommonConfigurations();
	for (IPackageFragmentRoot iPackageFragmentRoot : iJavaProject.getAllPackageFragmentRoots()) {
		if (!iPackageFragmentRoot.isExternal()
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), properties.getProperty(Constants.KEY_TRANSFORMATION_JAR))
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), Constants.ANTLR_JAR_FILE_NAME)
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), Constants.BEAN_SHELLJAR_FILE_NAME)
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), Constants.SL4JLOG)
				|| StringUtils.contains(iPackageFragmentRoot.getElementName(), properties.getProperty(Constants.KEY_EXPRESSION_JAR))) {
			URL url = null;
			if (!iPackageFragmentRoot.isExternal()) {
				url = BuildExpressionEditorDataSturcture.INSTANCE.getCurrentProject()
						.getFile(iPackageFragmentRoot.getPath().removeFirstSegments(1)).getLocation().toFile()
						.toURI().toURL();
				urlList.add(url);
			} else {
				url = iPackageFragmentRoot.getPath().toFile().toURI().toURL();
				urlList.add(url);
			}

			if (!iPackageFragmentRoot.isExternal()
					|| StringUtils.contains(iPackageFragmentRoot.getElementName(), properties.getProperty(Constants.KEY_TRANSFORMATION_JAR))) {
				if (transfromJarPath == null) {
					if (OSValidator.isMac() || OSValidator.isUnix())
						transfromJarPath = url.getPath() + Constants.COLON;
					else
						transfromJarPath = url.getPath() + Constants.SEMICOLON;
				} else {
					if (OSValidator.isMac() || OSValidator.isUnix())
						transfromJarPath = transfromJarPath + url.getPath() + Constants.COLON;
					else
						transfromJarPath = transfromJarPath + url.getPath() + Constants.SEMICOLON;
				}
			}
		}
	}
	
	returnObj[0]=urlList;
	returnObj[1]=transfromJarPath;
	returnObj[2]=getPropertyFilePath(iJavaProject);
	iJavaProject.close();
	return returnObj;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:48,代码来源:ValidateExpressionToolButton.java


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