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


Java IPath.equals方法代码示例

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


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

示例1: getConflictingContainerNameFor

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * Returns the name of a container with a location that encompasses targetDirectory. Returns null if there is no
 * conflict.
 *
 * @param targetDirectory
 *            the path of the directory to check.
 * @return the conflicting container name or <code>null</code>
 */
private String getConflictingContainerNameFor(String targetDirectory) {

	IPath rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation();
	IPath testPath = new Path(targetDirectory);
	// cannot export into workspace root
	if (testPath.equals(rootPath))
		return rootPath.lastSegment();

	// Are they the same?
	if (testPath.matchingFirstSegments(rootPath) == rootPath.segmentCount()) {
		String firstSegment = testPath.removeFirstSegments(rootPath.segmentCount()).segment(0);
		if (!Character.isLetterOrDigit(firstSegment.charAt(0)))
			return firstSegment;
	}

	return null;

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:AbstractExportToSingleFileWizardPage.java

示例2: resourceExistsIn

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * Process recursively the containers until we found a resource with the
 * specified path
 * 
 * @param container
 * @param path
 * @return
 * @throws CoreException
 */
private static boolean resourceExistsIn(IContainer container, IPath path) throws CoreException {
	boolean found = false;
	IResource[] members = container.members();
	for (IResource member : members) {
		if (member instanceof IContainer) {

			found = resourceExistsIn((IContainer) member, path);
			if (found)
				break;
		} else if (member instanceof IFile) {
			IFile file = (IFile) member;

			if (path.equals(file.getFullPath()))
				return true;
		}
	}
	return found;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:28,代码来源:ResourceManager.java

示例3: validateIsExistingProjectPath

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * Checks whether the specified project path points to an existing project and sets an according error message.
 *
 * Returns <code>true</code> otherwise.
 *
 * This method assumes that {@link #getProjectName()} returns a valid project name.
 */
private boolean validateIsExistingProjectPath() {
	IPath projectLocation = getLocationPath();
	final String projectName = getProjectName();

	// if workspace is project location (default location)
	if (projectLocation.equals(Platform.getLocation())) {
		// add project name since #getLocationPath does not return the full project location
		projectLocation = projectLocation.append(projectName);
	}

	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	boolean workspaceProjectExists = root.getProject(projectName).exists();

	// check for an existing manifest
	IPath manifestPath = projectLocation.append("manifest.n4mf");
	File existingManifest = new File(manifestPath.toString());

	// check for an existing file with the path of the project folder
	File existingFileAtProjectDirectory = new File(projectLocation.toString());
	boolean projectDirectoryIsExistingFile = existingFileAtProjectDirectory.exists()
			&& existingFileAtProjectDirectory.isFile();

	boolean isExistingNonWorkspaceProject = existingManifest.exists() && !workspaceProjectExists;

	if (projectDirectoryIsExistingFile) {
		// set error message if there is already at the specified project location
		setErrorMessage("There already exists a file at the location '" + projectLocation.toString() + "'.");
		return false;
	} else if (isExistingNonWorkspaceProject) {
		// set error message if the specified directory already represents an N4JS project
		setErrorMessage(
				"There already exists an N4JS project at the specified location. Please use 'File > Import...' to add it to the workspace.");
		return false;
	} else {
		// otherwise the project location does not exist yet
		return true;
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:46,代码来源:N4MFWizardNewProjectCreationPage.java

示例4: isSourceAttachmentEqual

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private static boolean isSourceAttachmentEqual(IPackageFragmentRoot root, IRuntimeClasspathEntry entry) throws JavaModelException {
    IPath entryPath = entry.getSourceAttachmentPath();
    if (entryPath == null) {
        return true;
    }
    IPath rootPath = root.getSourceAttachmentPath();
    if (rootPath == null) {
        // entry has a source attachment that the package root does not
        return false;
    }
    return rootPath.equals(entryPath);

}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:14,代码来源:JdtUtils.java

示例5: packageChanged

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
protected IStatus packageChanged() {
	StatusInfo status = new StatusInfo();
	IPackageFragmentRoot root = getPackageFragmentRoot();
	IJavaProject project = root != null ? root.getJavaProject() : null;

	String packName = getPackageText().getText();
	if (packName.length() > 0) {
		IStatus val = validatePackageName(packName, project);
		if (val.getSeverity() == IStatus.ERROR) {
			status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
			return status;
		} else if (val.getSeverity() == IStatus.WARNING) {
			status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
			// continue
		}
	} else {
		status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
	}

	if (project != null) {
		if (project.exists() && packName.length() > 0) {
			try {
				IPath rootPath = root.getPath();
				IPath outputPath = project.getOutputLocation();
				if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
					// if the bin folder is inside of our root, don't allow
					// to name a package
					// like the bin folder
					IPath packagePath = rootPath.append(packName.replace('.', '/'));
					if (outputPath.isPrefixOf(packagePath)) {
						status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation);
						return status;
					}
				}
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
				// let pass
			}
		}

		fCurrPackage = root.getPackageFragment(packName);
		IResource resource = fCurrPackage.getResource();
		if (resource != null) {
			if (resource.isVirtual()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageIsVirtual);
				return status;
			}
			if (!ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
				status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageNameFiltered);
				return status;
			}
		}
	} else {
		status.setError("");
	}
	return status;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:58,代码来源:ExportToJavaBeanWizardPage.java


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