當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。