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


Java IResource.getProject方法代码示例

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


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

示例1: getReplacementText

import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
@Override
public String getReplacementText() {
	SelectEcoreIFileDialog dialog = new SelectEcoreIFileDialog();
	if (dialog.open() == Dialog.OK) {
		Object[] selections = dialog.getResult();
		if(selections != null 
			&& selections.length != 0
			&& selections[0] instanceof IResource 
		){
			IResource ecoreFile = (IResource) selections[0];
			ecoreProject = ecoreFile.getProject();
			String path = "/"+ecoreFile.getProject().getName() +"/"+ecoreFile.getProjectRelativePath();
			URI uri = URI.createPlatformResourceURI(path,true);
			String replacementText = "\""+uri.toString()+"\"";
			return replacementText;
		}
	}
	return "";
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:20,代码来源:SelectEcoreProposal.java

示例2: visit

import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
@Override
public boolean visit(IResourceDelta delta) throws CoreException
{
	IResource resource = delta.getResource();
	if( resource.isDerived() )
	{
		return false;
	}
	if( resource.getType() == IResource.FILE )
	{
		IFile file = (IFile) resource;
		IProject project = resource.getProject();
		if( file.equals(JPFProject.getManifest(project)) )
		{
			manifestChanged = true;
			return false;
		}
	}
	return true;
}
 
开发者ID:equella,项目名称:Equella,代码行数:21,代码来源:JPFManifestBuilder.java

示例3: getTargetFolderForGeneratedTests

import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
 * Return the allowed folder where test can be generated in depending on the
 * user selection if the selected graph is in src/main/resource then
 * src/main/java if the selected graph is in src/test/resource then
 * src/test/java
 * 
 * @return
 */
public static IPath getTargetFolderForGeneratedTests(IResource selectedGraphFile) {

	IProject project = selectedGraphFile.getProject();

	IPath pathResourceTestFolder = project.getFullPath().append(getTestResourceFolder());
	if (ResourceManager.isInFolder(pathResourceTestFolder,
			selectedGraphFile.getParent().getFullPath()))
		return project.getFullPath().append(getTestSourceFolder());

	IPath pathResourceMainFolder = project.getFullPath().append(getMainResourceFolder());
	if (ResourceManager.isInFolder(pathResourceMainFolder,
			selectedGraphFile.getParent().getFullPath()))
		return project.getFullPath().append(getMainSourceFolder());
	return null;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:PreferenceManager.java

示例4: getPathWithinPackageFragment

import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
 * Return a path relative to its package fragment root
 * 
 * @param project
 * @param path
 * @return
 * @throws JavaModelException
 */
public static IPath getPathWithinPackageFragment(IResource ifile) throws JavaModelException {
	IProject project = ifile.getProject();
	IPath path = ifile.getFullPath();
	String[] segments = path.segments();
	IJavaProject jproject = JavaCore.create(project);
	IPackageFragment[] pkgs = jproject.getPackageFragments();
	IPath p = new Path("/");
	for (int i = 0; i < segments.length; i++) {
		for (int j = 0; j < pkgs.length; j++) {
			if (pkgs[j].getPath().equals(p)) {
				IPath ret = path.makeRelativeTo(pkgs[j].getPath());
				return ret;
			}
		}
		p = p.append(segments[i]);
	}
	return null;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:27,代码来源:ResourceManager.java

示例5: decorate

import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
@Override
public void decorate(Object element, IDecoration decoration) {
    if (element instanceof IResource) {
        IResource res = (IResource) element;
        IProject proj = res.getProject();
        try {
            if (proj != null && proj.isAccessible() && proj.hasNature(NATURE.ID)) {
                IMarker[] markers = res.findMarkers(MARKER.ERROR, false,
                        IResource.DEPTH_INFINITE);
                if (markers.length > 0) {
                    decoration.addOverlay(PlatformUI.getWorkbench().getSharedImages()
                            .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR));
                }
            }
        } catch (CoreException e) {
            Log.log(e);
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:20,代码来源:PgDecorator.java

示例6: setTargetFolderForTestInterface

import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
 * @param path
 */
public static void setTargetFolderForTestInterface(IResource resource,boolean main) {
	IProject project = resource.getProject();
	String path = resource.getFullPath().removeFirstSegments(1).toString();
	String key = GW4E_MAIN_SOURCE_GENERATED_INTERFACE;
	if (!main) {
		key = GW4E_TEST_SOURCE_GENERATED_INTERFACE;
	}		
	boolean projectScoped = isProjectScoped(key);
	SettingsManager.putValues(project, key,
			new String[] { path }, projectScoped);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,代码来源:PreferenceManager.java

示例7: preferences

import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
/**
 * Returns the plugin's project scoped preferences using the given 
 * resource to identify the project.
 * 
 * @param resource a resource from the project
 * @return the preferences
 */
public static Preferences preferences(IResource resource) {
	ProjectScope projectScope = new ProjectScope(resource.getProject());
	return projectScope.getNode(MinifyBuilder.BUILDER_ID);
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:12,代码来源:PrefsAccess.java


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