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


Java IPath.append方法代码示例

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


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

示例1: propertyChanged

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public void propertyChanged(Object source, int propId) {
	// When a property from the xslEditor Changes, walk the list all the listeners and notify them.
	Object listeners[] = listenerList.getListeners();
	for (int i = 0; i < listeners.length; i++) {
		IPropertyListener listener = (IPropertyListener) listeners[i];
		listener.propertyChanged(this, propId);
	}

	if (propId == IEditorPart.PROP_DIRTY) {
		if (!xmlEditor.isDirty()) {
			// We changed from Dirty to non dirty ==> User has saved so,
			// launch Convertigo engine

			// "touch" the parent style sheet ==> Convertigo engine will
			// recompile it
			
			IPath path;
			path = file.getRawLocation();
			path = path.append("../../" + parentStyleSheetUrl);
			File parentFile = path.toFile();
			parentFile.setLastModified(System.currentTimeMillis());
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:25,代码来源:XslRuleEditor.java

示例2: performOk

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * @see PreferencePage#performOk
 */
@Override
public boolean performOk()
{
	if( !modified )
	{
		return true;
	}
	IPath path = Path.EMPTY;
	Object[] checked = listViewer.getCheckedElements();
	for( Object elements : checked )
	{
		path = path.append(((IProject) elements).getName());
	}
	IPreferenceStore prefs = getPreferenceStore();
	prefs.setValue(JPFClasspathPlugin.PREF_PARENT_REGISTRIES, path.toString());
	try
	{
		((IPersistentPreferenceStore) prefs).save();
	}
	catch( IOException e )
	{
		JPFClasspathLog.logError(e);
	}
	return true;
}
 
开发者ID:equella,项目名称:Equella,代码行数:29,代码来源:JPFParentRepositoriesPage.java

示例3: getPathWithinPackageFragment

import org.eclipse.core.runtime.IPath; //导入方法依赖的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

示例4: computeCompilationUnitDestination

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private IFolder computeCompilationUnitDestination() throws CoreException {
	IPath pkg = null;
	switch (type) {
	case TEST_INTERFACE:
		IProject project = graphFile.getProject();
		boolean isMain = PreferenceManager.isInMainPath(getDestination().getFile(graphFile.getName()).getFullPath());
		pkg = ResourceManager.getPathWithinPackageFragment(getDestination().getFile("foo.txt")).removeLastSegments(1);
		IPath pathFolderForTestInterface = project.getFullPath()
				.append(GraphWalkerContextManager.getTargetFolderForTestInterface(project.getName(), isMain))
				.append(pkg);
		ResourceManager.ensureFolderPath(pathFolderForTestInterface);
		return (IFolder) ResourceManager.getResource(pathFolderForTestInterface.toString());

	case TEST_IMPLEMENTATION:
		IPath path = PreferenceManager.getTargetFolderForGeneratedTests(getDestination().getFile(graphFile.getName()));
		pkg = ResourceManager.getPathWithinPackageFragment(getDestination().getFile("foo.txt")).removeLastSegments(1);
		IPath newpath = path.append(pkg);
		ResourceManager.ensureFolderPath(newpath);
		return (IFolder) ResourceManager.getResource(newpath.toString());
	}

	throw new IllegalStateException("Unknown type " + type);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:24,代码来源:MoveCompilationUnitChange.java

示例5: createFile

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public static IFile createFile(IProject project, IFile file, InputStream contentStream, IProgressMonitor monitor) throws CoreException {
	if (!file.exists()) 
	{
		IPath path = file.getProjectRelativePath();
		if (path.segmentCount() > 1) {
			IPath currentFolderPath = new Path("");
			for (int i=0; i<path.segmentCount()-1; i++) {
				currentFolderPath = currentFolderPath.append(path.segment(i));
				createFolder(project, currentFolderPath, monitor);
			}				
		}
		try
		{
			file.create(contentStream, true, monitor);
		}
		finally
		{
			try {
				contentStream.close();
			} catch (IOException e) {
				throw new CoreException(new Status(Status.ERROR, "", "Could not close stream for file " + file.getFullPath(), e));
			}
		}
	}
	return file;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:27,代码来源:IProjectUtils.java

示例6: createBaseProject

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * Creates the base structure of the project under specified location and name
 * @param projectName
 * @param location
 * @return
 * @throws CoreException 
 */
private IProject createBaseProject(String projectName, URI location) throws CoreException {
	IProject newProject=null;
	
	if(location==null){
			newProject = createTheProjectAtSpecifiedLocation(projectName,location);
	}
	else{
		IPath iPath	 = new Path(location.getPath());
		if (!StringUtils.equals(iPath.lastSegment(), projectName)) {
			iPath = iPath.append(projectName);
		}
		URI newLocation=URI.create(iPath.toFile().toURI().toString());
			newProject=	createTheProjectAtSpecifiedLocation(projectName, newLocation);
	}
	return newProject;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:ProjectStructureCreator.java

示例7: computeDefaultFileName

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
protected String computeDefaultFileName() {
	int count = 0;
	String fileName = defaultName + defaultFileExtension;
	IPath containerFullPath = getContainerFullPath();
	if (containerFullPath != null) {
		while (true) {
			IPath path = containerFullPath.append(fileName);
			if (ResourcesPlugin.getWorkspace().getRoot().exists(path)) {
				count++;
				fileName = defaultName + count + defaultFileExtension;
			} else {
				break;
			}
		}
	}
	return fileName;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:18,代码来源:ModelFilePage.java

示例8: validateLinkedResource

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * Checks whether the linked resource target is valid. Sets the error
 * message accordingly and returns the status.
 * 
 * @return IStatus validation result from the CreateLinkedResourceGroup
 */
protected IStatus validateLinkedResource() {
	IPath containerPath = resourceGroup.getContainerFullPath();
	IPath newFilePath = containerPath.append(resourceGroup.getResource());
	IFile newFileHandle = createFileHandle(newFilePath);
	IStatus status = linkedResourceGroup
			.validateLinkLocation(newFileHandle);

	if (status.getSeverity() == IStatus.ERROR) {
		if (firstLinkCheck) {
			setMessage(status.getMessage());
			setErrorMessage(null);
		} else {
			setErrorMessage(status.getMessage());
		}
	} else if (status.getSeverity() == IStatus.WARNING) {
		setMessage(status.getMessage(), WARNING);
		setErrorMessage(null);
	}
	return status;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:27,代码来源:WizardNewFileCreationPage.java

示例9: isFilteredByParent

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private boolean isFilteredByParent() {
	if ((linkedResourceGroup == null) || linkedResourceGroup.isEnabled())
		return false;
	IPath containerPath = resourceGroup.getContainerFullPath();
	if (containerPath == null)
		return false;
	String resourceName = resourceGroup.getResource();
	if (resourceName == null)
		return false;
	if (resourceName.length() > 0) {
		IPath newFolderPath = containerPath.append(resourceName);
		IFile newFileHandle = createFileHandle(newFolderPath);
		IWorkspace workspace = newFileHandle.getWorkspace();
		return !workspace.validateFiltered(newFileHandle).isOK();
	}
	return false;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:18,代码来源:WizardNewFileCreationPage.java

示例10: updateFileExtension

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * Updates the file extension according to the current selection. (tree + element name input)
 */
private void updateFileExtension() {
	Object selection = treeViewer.getStructuredSelection().getFirstElement();
	String elementFileName = elementNameInput.getText();

	if (null == selection) {
		setFileExtension(defaultFileExtension);
	}

	// If an existing file is selected and element name input equals its name
	if (selection instanceof IFile && elementFileName.equals(((IFile) selection).getName())) {
		// Use the file's extension
		setFileExtension(((IFile) selection).getFileExtension());
	} else if (selection instanceof IResource) {
		// Otherwise compute the path of the selected element
		IPath basepath;
		if (selection instanceof IFile) {
			basepath = ((IFile) selection).getParent().getFullPath();
		} else {
			basepath = ((IResource) selection).getFullPath();
		}
		IPath pathOfSelection = basepath.append(elementFileName);

		IFile n4jsFile = workspaceRoot.getFile(pathOfSelection.addFileExtension(N4JSGlobals.N4JS_FILE_EXTENSION));
		IFile n4jsdFile = workspaceRoot.getFile(pathOfSelection.addFileExtension(N4JSGlobals.N4JSD_FILE_EXTENSION));

		// If a n4js or n4jsd file with the specified location exists, use the proper file extension. Otherwise use
		// the default file extension.
		if (n4jsdFile.exists()) {
			setFileExtension(N4JSGlobals.N4JSD_FILE_EXTENSION);
		} else if (n4jsFile.exists()) {
			setFileExtension(N4JSGlobals.N4JS_FILE_EXTENSION);
		} else {
			setFileExtension(defaultFileExtension);
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:40,代码来源:ModuleSpecifierSelectionDialog.java

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

示例12: getGraphFile

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public File getGraphFile () throws FileNotFoundException {
	String[] localPath = getGraphmlFilePath();
	IPath path = ResourceManager.getProject(gwproject).getFullPath();
	for (int i =1; i < localPath.length; i++) {
		path = path.append(localPath[i]);
	}
	return ResourceManager.toFile(path);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:GW4EProjectTestCase.java

示例13: createFolder

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
 * Create recursively folders in the project.
 * Do nothing if folder already exists.
 * @param project
 * @param path
 * @param monitor
 * @return
 * @throws CoreException
 */
public static IFolder createFolder(IProject project, IPath path, IProgressMonitor monitor) throws CoreException {
	IFolder folder = project.getFolder(path);
	if (!folder.exists()) {
		if (path.segmentCount() > 1) {
			IPath currentFolderPath = new Path("");
			for (int i=0; i<path.segmentCount()-1; i++) {
				currentFolderPath = currentFolderPath.append(path.segment(i));
				createFolder(project, currentFolderPath, monitor);
			}				
		}
		folder.create(true, true, monitor);
	}
	return folder;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:24,代码来源:IProjectUtils.java

示例14: importParamterFileToProject

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private boolean importParamterFileToProject(String[] listOfFilesToBeImported, String source,String destination, ParamterFileTypes paramterFileTypes) {

		for (String fileName : listOfFilesToBeImported) {
			String absoluteFileName = source + fileName;
			IPath destinationIPath=new Path(destination);
			destinationIPath=destinationIPath.append(fileName);
			File destinationFile=destinationIPath.toFile();
			try {
				if (!ifDuplicate(listOfFilesToBeImported, paramterFileTypes)) {
					if (StringUtils.equalsIgnoreCase(absoluteFileName, destinationFile.toString())) {
						return true;
					} else if (destinationFile.exists()) {
						int returnCode = doUserConfirmsToOverRide();
						if (returnCode == SWT.YES) {
							FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
						} else if (returnCode == SWT.NO) {
							return true;
						} else {
							return false;
						}
					} else {
						FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
					}
				}
			} catch (IOException e1) {
				if(StringUtils.endsWithIgnoreCase(e1.getMessage(), ErrorMessages.IO_EXCEPTION_MESSAGE_FOR_SAME_FILE)){
					return true;
				}
				MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
				messageBox.setText(MessageType.ERROR.messageType());
				messageBox.setMessage(ErrorMessages.UNABLE_TO_POPULATE_PARAM_FILE + " " + e1.getMessage());
				messageBox.open();				
				logger.error("Unable to copy prameter file in current project work space");
				return false;
			}
		}
		return true;
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:39,代码来源:MultiParameterFileDialog.java

示例15: setupLinkedResourceTarget

import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private void setupLinkedResourceTarget() {
	if (!setupLinkedResourceTargetRecursiveFlag) {
		setupLinkedResourceTargetRecursiveFlag = true;
		try {
			if (isFilteredByParent()) {
				URI existingLink = linkedResourceGroup.getLinkTargetURI();
				boolean setDefaultLinkValue = false;
				if (existingLink == null)
					setDefaultLinkValue = true;
				else {
					IPath path = URIUtil.toPath(existingLink);
					if (path != null)
						setDefaultLinkValue = path.toPortableString()
								.length() > 0;
				}

				if (setDefaultLinkValue) {
					IPath containerPath = resourceGroup
							.getContainerFullPath();
					IPath newFilePath = containerPath.append(resourceGroup
							.getResource());
					IFile newFileHandle = createFileHandle(newFilePath);
					try {
						URI uri = newFileHandle.getPathVariableManager()
								.convertToRelative(
										newFileHandle.getLocationURI(),
										false, null);
						linkedResourceGroup.setLinkTarget(URIUtil.toPath(
								uri).toPortableString());
					} catch (CoreException e) {
						// nothing
					}
				}
			}
		} finally {
			setupLinkedResourceTargetRecursiveFlag = false;
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:40,代码来源:WizardNewFileCreationPage.java


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