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