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


Java IPath.isPrefixOf方法代碼示例

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


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

示例1: childrenExistInClasspath

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
/**
 * Return whether folderPath has children in the classpath
 * 
 * @param project
 * @param folderPath
 * @param monitor
 * @return
 * @throws JavaModelException
 */
public static IResource childrenExistInClasspath(IProject project, String folderPath, IProgressMonitor monitor)
		throws JavaModelException {
	IJavaProject javaProject = JavaCore.create(project);
	IClasspathEntry[] entries = javaProject.getRawClasspath();
	IPath folder = project.getFolder(folderPath).getFullPath();
	for (int i = 0; i < entries.length; i++) {
		if (folder.isPrefixOf(entries[i].getPath())) {
			IPath path = entries[i].getPath();
			IResource resource = ResourceManager.getResource(path.toString());
			return resource;
		}
	}
	return null;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:24,代碼來源:ClasspathManager.java

示例2: acceptFile

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
private boolean acceptFile(IFile in) {
	if (!PreferenceManager.isGraphModelFile(in))
		return false;
	IProject project = in.getProject();
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	for (int i = 0; i < folders.length; i++) {
		IPath base = project.getFullPath().append(folders[i]);
		if (base.isPrefixOf(in.getFullPath())) {
			return true;
		}
	}
	return false;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:14,代碼來源:RenameGraphParticipant.java

示例3: acceptDestination

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
private boolean acceptDestination(IProject project,IPath target) {
	 
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	for (int i = 0; i < folders.length; i++) {
		IPath base = project.getFullPath().append(folders[i]);
		if (base.isPrefixOf(target)) {
			return true;
		}
	}
	return false;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:12,代碼來源:MoveGraphParticipant.java

示例4: buildGeneratedAnnotationValue

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
public static IPath buildGeneratedAnnotationValue(IFile in) {
	IPath ret = null;
	if (!PreferenceManager.isGraphModelFile(in))
		return null;
	IProject project = in.getProject();
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	for (int i = 0; i < folders.length; i++) {
		IPath base = project.getFullPath().append(folders[i]);
		if (base.isPrefixOf(in.getFullPath())) {
			ret = in.getFullPath().makeRelativeTo(project.getFullPath());
			break;
		}
	}
	return ret;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:16,代碼來源:Helper.java

示例5: buildModelAnnotationValue

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
public static IPath buildModelAnnotationValue (IFile in) {
	IPath ret = null;
	if (!PreferenceManager.isGraphModelFile(in)) return null;
	IProject project = in.getProject();
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	for (int i = 0; i < folders.length; i++) {
		IPath base = project.getFullPath().append(folders[i]);
		if (base.isPrefixOf(in.getFullPath())) {
			ret = in.getFullPath().makeRelativeTo(base);
			break;
		}
	}
	return ret;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:15,代碼來源:Helper.java

示例6: validatePage

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
public boolean validatePage() {
	setErrorMessage(null);
	if (!displayProjects)
		return true;
	if (createPackageButton != null)
		createPackageButton.setEnabled(false);
	if (fDestinationField != null) {
		ITreeSelection sl = fDestinationField.getStructuredSelection();
		if (sl.isEmpty()) {
			setErrorMessage(MessageUtil.getString("choose_a_target_folder_for_the_graph"));
			return false;	
		}
		if (!(sl.getFirstElement() instanceof IFolder)) {
			setErrorMessage(MessageUtil.getString("choose_a_target_folder_for_the_graph"));
			return false;
		}
		if (sl.getFirstElement() instanceof IFolder) {
			IFolder folder = (IFolder) sl.getFirstElement();
			String[] folders = PreferenceManager.getDefaultAuthorizedFolderForGraphDefinition();
			boolean found = false;
			for (String f : folders) {
				IFolder tmp = (IFolder) folder;
				if (tmp == null)
					return false;
				IProject project = tmp.getProject();
				IPath p = new Path(project.getFullPath().toString()).append(f);
				IPath tmpPath = tmp.getFullPath();
				if (p.isPrefixOf(tmpPath)) {
					createPackageButton.setEnabled(true);
					found = true;
				}
			}
			if (!found) {
				setErrorMessage(MessageUtil.getString("choose_a_target_folder_for_the_graph"));
				return false;
			}
		}
	}
	if (this.provider != null) {
		if (this.provider.getDefaultFileName() != null
				&& ((nameField.getText() == null) || (nameField.getText().trim().length() == 0))) {
			setErrorMessage(MessageUtil.getString("choose_a_valid_filename"));
			return false;
		}
		String value = nameField.getText();
		if (this.provider.getDefaultFileName() != null && !isValidFilename(value)) {
			setErrorMessage(MessageUtil.getString("choose_a_valid_filename"));
			return false;
		}
	}

	return true;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:54,代碼來源:TemplateComposite.java

示例7: isFolderMainResources

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
public static boolean isFolderMainResources(IProject project, IPath path) {
	IPath sourcemainPath = project.getFullPath().append(Constant.SOURCE_MAIN_RESOURCES);
	return sourcemainPath.isPrefixOf(path);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:5,代碼來源:GraphWalkerContextManager.java

示例8: buildFiles

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
public static PgDatabase buildFiles(Collection<IFile> files, IProgressMonitor monitor,
        List<FunctionBodyContainer> funcBodies) throws InterruptedException, IOException, CoreException {
    SubMonitor mon = SubMonitor.convert(monitor, files.size());
    Set<String> schemaDirnamesLoaded = new HashSet<>();
    IPath schemasPath = new Path(WORK_DIR_NAMES.SCHEMA.name());
    PgDatabase db = new PgDatabase(false);
    db.setArguments(new PgDiffArguments());

    for (IFile file : files) {
        IPath filePath = file.getProjectRelativePath();
        if (!"sql".equals(file.getFileExtension()) || !isInProject(filePath)) { //$NON-NLS-1$
            // skip non-sql or non-project files
            // still report work
            mon.worked(1);
            continue;
        }

        if (schemasPath.isPrefixOf(filePath)) {
            IPath relSchemasPath = filePath.makeRelativeTo(schemasPath);
            String schemaDirname;
            boolean schemaDefSql = relSchemasPath.segmentCount() == 1;
            if (schemaDefSql) {
                // schema definition SQL-file
                schemaDirname = relSchemasPath.removeFileExtension().lastSegment();
            } else {
                // schema-contained object
                // preload its schema so that search_path parses normally
                schemaDirname = relSchemasPath.segment(0);
            }
            if (!schemaDirnamesLoaded.add(schemaDirname)) {
                // schema already loaded, skip
                if (schemaDefSql) {
                    // report schema pre-built if the same schema was to be built normally as well
                    mon.worked(1);
                }
                continue;
            } else if (!schemaDefSql) {
                // pre-load schema for object's search path
                // otherwise we're dealing with the schema file itself, allow it to load normally
                // don't pass progress monitor since this file isn't in the original load-set
                loadFile(file.getProject().getFile(schemasPath.append(schemaDirname + ".sql")), //$NON-NLS-1$
                        null, db, funcBodies, null);
            }
        }

        loadFile(file, mon, db, funcBodies, null);
    }
    return db;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:50,代碼來源:PgUIDumpLoader.java

示例9: 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

示例10: isInFolder

import org.eclipse.core.runtime.IPath; //導入方法依賴的package包/類
/**
 * Return whether the candidate child is on the parent folder
 * 
 * @param parent
 * @param candidateChild
 * @return
 */
public static boolean isInFolder(IPath parent, IPath candidateChild) {
	return parent.isPrefixOf(candidateChild);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:11,代碼來源:ResourceManager.java


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