當前位置: 首頁>>代碼示例>>Java>>正文


Java IProject.isOpen方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IProject.isOpen方法的典型用法代碼示例。如果您正苦於以下問題:Java IProject.isOpen方法的具體用法?Java IProject.isOpen怎麽用?Java IProject.isOpen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IProject的用法示例。


在下文中一共展示了IProject.isOpen方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getProject

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
/**
 * Returns with the corresponding {@link IN4JSProject N4JS project} for the given {@link IProject Eclipse project}
 * argument. Returns with {@code null} if
 * <ul>
 * <li>the {@code project} argument is {@code null} or</li>
 * <li>no {@link IN4JSProject#exists() existing} {@link IN4JSProject N4JS project} project can be found with the
 * desired project ID.</li>
 * </ul>
 *
 * @param project
 *            the searched project.
 * @return the N4JS project or {@code null} if such project does not exist.
 */
public IN4JSProject getProject(IProject project) {

	checkArgument(!(project instanceof ExternalProject), "Expected Eclipse workspace project. Got: " + project);

	if (null == project || !project.exists() || !project.isOpen()) {
		return null;
	}

	final String projectName = Strings.nullToEmpty(project.getName());
	final IN4JSProject n4Project = core.create(createPlatformResourceURI(projectName, true));
	if (null == n4Project || !n4Project.exists() || n4Project.isExternal()) {
		return null;
	}
	return n4Project;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:29,代碼來源:N4JSProjectExplorerHelper.java

示例2: getWorkingSetId

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
private String getWorkingSetId(final IProject project) {
	final Path projectPath = project.getLocation().toFile().toPath();
	final Path parentPath = projectPath.getParent();

	if (WS_ROOT_PATH.equals(parentPath)) {
		return OTHERS_WORKING_SET_ID;
	}

	if (parentPath.startsWith(WS_ROOT_PATH)) {
		return parentPath.toFile().getName();
	}

	if (!project.isOpen()) { // closed project appear under Other Projects WS
		return OTHERS_WORKING_SET_ID;
	}

	for (final Path repositoryPath : repositoryPaths) {
		if (repositoryPath.equals(projectPath)) {
			return projectPath.toFile().getName();
		} else if (projectPath.startsWith(repositoryPath)) {
			return parentPath.toFile().getName();
		}
	}

	return OTHERS_WORKING_SET_ID;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:27,代碼來源:ProjectLocationAwareWorkingSetManager.java

示例3: evaluateSelection

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
private int evaluateSelection(final Object[] array, final List<IProject> allOpenProjects) {
	int status = 0;
	for (int i = 0; i < array.length; i++) {
		final Object curr = array[i];
		if (curr instanceof IProject) {
			final IProject project = (IProject) curr;
			if (project.isOpen()) {
				allOpenProjects.add(project);
			} else {
				status |= CLOSED_PROJECTS_SELECTED;
			}
		} else {
			status |= NON_PROJECT_SELECTED;
			if (curr instanceof WorkingSet) {
				final int res = evaluateSelection(((WorkingSet) curr).getElements(), allOpenProjects);
				status |= res;
			}
		}
	}
	return status;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:22,代碼來源:N4JSProjectActionGroup.java

示例4: hasNature

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
/**
 * Test whether the project has the passed nature
 * 
 * @param receiver
 * @param nature
 * @return
 */
public static boolean hasNature(Object receiver, String nature) {
	IProject project = JDTManager.toJavaProject(receiver);
	if (project == null || !project.isOpen())
		return false;
	IProjectDescription description;
	try {
		description = project.getDescription();
	} catch (CoreException e) {
		ResourceManager.logException(e);
		return false;
	}
	String[] natures = description.getNatureIds();
	for (int i = 0; i < natures.length; i++) {
		if (nature.equalsIgnoreCase(natures[i]))
			return true;
	}
	return false;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:26,代碼來源:ResourceManager.java

示例5: isProjectOpened

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
public boolean isProjectOpened(String projectName) {
	boolean isOpen = false;
	try {
		IProject resourceProject = ConvertigoPlugin.getDefault().createProjectPluginResource(projectName);
		isOpen = resourceProject != null && resourceProject.isOpen();
	} catch (CoreException e) {
		logWarning(e, "Error when checking if '" + projectName + "' is open", false);
	}
	return isOpen;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:11,代碼來源:ConvertigoPlugin.java

示例6: getProjectPluginResource

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
public IProject getProjectPluginResource(String projectName, IProgressMonitor monitor) throws CoreException {
	if (cacheIProject.containsKey(projectName)) return (IProject)cacheIProject.get(projectName);
	
	IProject resourceProject = createProjectPluginResource(projectName);
	if (resourceProject.exists()) {
		resourceProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);			
		if (!resourceProject.isOpen())
			resourceProject.open(monitor);
	}
	cacheIProject.put(projectName, resourceProject);
	
	return resourceProject;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:14,代碼來源:ConvertigoPlugin.java

示例7: isPluginProject

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
public static boolean isPluginProject(IProject project)
{
	try
	{
		if( project.isOpen() && project.hasNature(JPFProjectNature.NATURE_ID) )
			return JPFProject.getManifest(project).exists();
	}
	catch( CoreException e )
	{
		return false;
	}
	return false;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:WorkspacePluginModelManager.java

示例8: isInterestingProject

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
@Override
protected boolean isInterestingProject(IProject project)
{
	try
	{
		return project.isOpen() && project.hasNature(JPFJarNature.NATURE_ID);
	}
	catch( CoreException e )
	{
		JPFClasspathLog.logError(e);
		return false;
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:WorkspaceJarModelManager.java

示例9: getChildren

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
@Override
public Object[] getChildren(Object o)
{
	if( !(o instanceof IWorkspace) )
	{
		return new Object[0];
	}

	// Collect all the projects in the workspace except the given
	// project
	IProject[] projects = ((IWorkspace) o).getRoot().getProjects();
	List<IProject> referenced = new ArrayList<>(projects.length);
	boolean found = false;
	for( int i = 0; i < projects.length; i++ )
	{
		IProject otherProject = projects[i];
		if( !found && otherProject.equals(project) )
		{
			found = true;
			continue;
		}
		try
		{
			if( otherProject.isOpen() && otherProject.hasNature(JPFJarNature.NATURE_ID) )
			{
				referenced.add(otherProject);
			}
		}
		catch( CoreException e )
		{
			// ignore
		}
	}

	return referenced.toArray();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:37,代碼來源:JarProjectContentProvider.java

示例10: hasNature

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
public static boolean hasNature(IProject project)
{
	try
	{
		return project.isOpen() && project.hasNature(NATURE_ID);
	}
	catch( CoreException e )
	{
		JPFClasspathLog.logError(e);
		return false;
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:13,代碼來源:JPFProjectNature.java

示例11: createProject

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
public static IJavaProject createProject(String name) throws CoreException {

		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IProject project = root.getProject(name);
		if (!project.exists()) {
			project.create(new NullProgressMonitor());
		} else {
			project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
		}

		if (!project.isOpen()) {
			project.open(new NullProgressMonitor());
		}

		IFolder binFolder = project.getFolder("bin");
		if (!binFolder.exists()) {
			createFolder(binFolder, false, true, new NullProgressMonitor());
		}
		IPath outputLocation = binFolder.getFullPath();

		addNatureToProject(project, JavaCore.NATURE_ID, new NullProgressMonitor());

		IJavaProject jproject = JavaCore.create(project);
		jproject.setOutputLocation(outputLocation, new NullProgressMonitor());

		IClasspathEntry[] entries = PreferenceConstants.getDefaultJRELibrary();

		jproject.setRawClasspath(entries, new NullProgressMonitor());

		return jproject;
	}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:32,代碼來源:ProjectHelper.java

示例12: createElement

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
@Override
public IAdaptable createElement(IMemento memento) {
    String projName = memento.getString(TAG_PROJECT);
    ProjectEditorInput input = new ProjectEditorInput(projName);

    IProject project =
            (projName == null) ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
    if (project == null || !project.exists() || !project.isOpen()) {
        input.setError(new PgCodekeeperUIException(Messages.project_either_closed_or_deleted + projName));
    }

    return input;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:14,代碼來源:ProjectEditorInputFactory.java

示例13: createTheProjectAtSpecifiedLocation

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
private IProject createTheProjectAtSpecifiedLocation(String projectName,
		URI location) throws CoreException {
	IProject newProject;
	newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

	if(!newProject.exists()){
		IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName());
		if (location != null && ResourcesPlugin.getWorkspace().getRoot().getLocationURI().equals(location)) {
			desc.setLocationURI(null);
		}
		else{
			desc.setLocationURI(location);
		}

		try {
			newProject.create(desc, null);
			if (!newProject.isOpen()) {
				newProject.open(null);
			}
			logger.debug("Project base structure created"); 
		} catch (CoreException exception) {
			logger.debug("Project base structure creation failed");
			throw exception;
		}
	}
	return newProject;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:28,代碼來源:ProjectStructureCreator.java

示例14: isOpenProjectExists

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
private Boolean isOpenProjectExists(Boolean openProjectFound, IProject[] projects) {
	for (IProject project : projects) {
		if (project.isOpen()) {
			openProjectFound = true;
			break;
		}
	}
	return openProjectFound;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:10,代碼來源:JobCreationWizard.java

示例15: loadAllComponentTypes

import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
private static List<String> loadAllComponentTypes() throws CoreException {
	List<String> files = new ArrayList<String>();
	for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
		if (project.isAccessible() && project.isOpen()) {
			files.addAll(loadModels(project));
		}
	}
	return files;
}
 
開發者ID:awortmann,項目名稱:xmontiarc,代碼行數:10,代碼來源:DesignerHelper.java


注:本文中的org.eclipse.core.resources.IProject.isOpen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。