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


Java URIUtil类代码示例

本文整理汇总了Java中org.eclipse.core.filesystem.URIUtil的典型用法代码示例。如果您正苦于以下问题:Java URIUtil类的具体用法?Java URIUtil怎么用?Java URIUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: processLine

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
@Override
  public boolean processLine(String line) {
    // try each tool..
    for (Entry<Matcher, IToolCommandlineParser> entry : currentBuildOutputToolParsers.entrySet()) {
      final Matcher cmdDetector = entry.getKey();
      cmdDetector.reset(line);
      if (cmdDetector.lookingAt()) {
        // found a matching tool parser
        String args = line.substring(cmdDetector.end());
        args = ToolCommandlineParser.trimLeadingWS(args);
        final IToolCommandlineParser botp = entry.getValue();
        final IPath cwd= URIUtil.toPath(cwdTracker.getWorkingDirectoryURI());
        final List<ICLanguageSettingEntry> entries = botp.processArgs(cwd, args);
        // attach settings to project...
        if (entries != null && entries.size() > 0) {
          super.setSettingEntries(currentCfgDescription, currentProject, botp.getLanguageId(), entries);
        }
        return true; // skip other build output parsers
      }
    }
//    System.out.println(line);
    return false;
  }
 
开发者ID:15knots,项目名称:cmake4eclipse,代码行数:24,代码来源:CmakeBuildOutputParser.java

示例2: createMarkersForResource

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
private void createMarkersForResource(Path resourcePath, String setting, Integer lineNumer, int severity,
        String message) throws CoreException {
    if (resourcePath != null) {
        IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
        try {
            IFile[] files = workspaceRoot.findFilesForLocationURI(URIUtil.toURI(resourcePath));
            for (IFile file : files) {
                IMarker marker = Marker.create(file, setting, lineNumer.intValue(), message, severity);
                if (marker != null) {
                    markers.add(marker);
                    break; // exit loop
                }
            }
        } catch (IllegalArgumentException ex) {
            // no op, because the resource cannot be found, so it's not absolute
            // see IWorkspaceRoot
            //if (!location.isAbsolute())
            //    throw new IllegalArgumentException()
            // see https://github.com/anb0s/eclox/issues/195
        }
    }
}
 
开发者ID:anb0s,项目名称:eclox,代码行数:23,代码来源:BuildJob.java

示例3: importGWTProjects

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
private void importGWTProjects() throws Exception {
  IWorkspace workspace = ResourcesPlugin.getWorkspace();
  String platform = Util.getPlatformName();
  String gwtDevProjectName = "gwt-dev-" + platform;

  // Get the path to the Eclipse project files for GWT
  IPath gwtProjectsDir = URIUtil.toPath(workspace.getPathVariableManager().getURIValue("GWT_ROOT")).append("eclipse");

  // Import gwt-dev
  IPath gwtDevDir = gwtProjectsDir.append("dev").append(platform);
  importProject(gwtDevProjectName, gwtDevDir);

  // Import gwt-user
  IPath gwtUserDir = gwtProjectsDir.append("user");
  importProject("gwt-user", gwtUserDir);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:17,代码来源:AbstractGWTPluginTestCase.java

示例4: importGwtSourceProjects

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
/**
 * Imports the gwt-dev and gwt-user projects into the workspace.
 *
 * @see #removeGwtSourceProjects()
 */
public static void importGwtSourceProjects() throws CoreException {
  IWorkspace workspace = ResourcesPlugin.getWorkspace();
  String gwtDevProjectName = "gwt-dev";

  // Get the path to the Eclipse project files for GWT
  URI gwtProjectsUri = workspace.getPathVariableManager().getURIValue("GWT_ROOT");
  IPath gwtProjectsDir = URIUtil.toPath(gwtProjectsUri).append("eclipse");

  // Import gwt-dev
  IPath gwtDevDir = gwtProjectsDir.append("dev");
  ProjectUtilities.importProject(gwtDevProjectName, gwtDevDir);

  // Import gwt-user
  IPath gwtUserDir = gwtProjectsDir.append("user");
  ProjectUtilities.importProject("gwt-user", gwtUserDir);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:22,代码来源:GwtRuntimeTestUtilities.java

示例5: createProject

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
protected IProject createProject(IProgressMonitor monitor) throws CoreException {
  IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
  IProject project = workspaceRoot.getProject(projectName);
  if (!project.exists()) {
    URI uri;
    if (isWorkspaceRootLocationURI(locationURI)) {
      // If you want to put a project in the workspace root then the location
      // needs to be null...
      uri = null;
    } else {
      // Non-default paths need to include the project name
      IPath path = URIUtil.toPath(locationURI).append(projectName);
      uri = URIUtil.toURI(path);
    }

    BuildPathsBlock.createProject(project, uri, monitor);
  }
  return project;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:20,代码来源:WebAppProjectCreator.java

示例6: getURI

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
/**
 * Returns the URI for the specific editor input.
 * 
 * @param input
 *            the editor input
 * @return the URI, or null if none could be determined
 */
public static URI getURI(IEditorInput input)
{
	if (input instanceof IFileEditorInput)
	{
		return ((IFileEditorInput) input).getFile().getLocationURI();
	}
	if (input instanceof IURIEditorInput)
	{
		return ((IURIEditorInput) input).getURI();
	}
	if (input instanceof IPathEditorInput)
	{
		return URIUtil.toURI(((IPathEditorInput) input).getPath());
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:24,代码来源:UIUtils.java

示例7: getPath

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
private IPath getPath(IEditorPart otherEditor)
{
	IEditorInput input = otherEditor.getEditorInput();
	try
	{
		if (input instanceof IPathEditorInput)
		{
			return ((IPathEditorInput) input).getPath();
		}

		URI uri = (URI) input.getAdapter(URI.class);
		if (uri != null)
		{
			return new Path(uri.getHost() + Path.SEPARATOR + uri.getPath());
		}
		if (input instanceof IURIEditorInput)
		{
			return URIUtil.toPath(((IURIEditorInput) input).getURI());
		}
	}
	catch (Exception e)
	{
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:FilenameDifferentiator.java

示例8: handleDestinationBrowseButtonPressed

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
/**
 *	Open an appropriate destination browser so that the user can specify a source
 *	to import from
 */
protected void handleDestinationBrowseButtonPressed() {
	FileDialog dialog= new FileDialog(getContainer().getShell(), SWT.SAVE);
	dialog.setFilterExtensions(ArchiveFileFilter.JAR_ZIP_FILTER_EXTENSIONS);

	String currentSourceString= getDestinationValue();
	int lastSeparatorIndex= currentSourceString.lastIndexOf(File.separator);
	if (lastSeparatorIndex != -1) {
		dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex));
		dialog.setFileName(currentSourceString.substring(lastSeparatorIndex + 1, currentSourceString.length()));
	}
	String selectedFileName= dialog.open();
	if (selectedFileName != null) {
		IContainer[] findContainersForLocation= ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(URIUtil.toURI(new Path(selectedFileName).makeAbsolute()));
		if (findContainersForLocation.length > 0) {
			selectedFileName= findContainersForLocation[0].getFullPath().makeRelative().toString();
		}
		fDestinationNamesCombo.setText(selectedFileName);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:AbstractJarDestinationWizardPage.java

示例9: getSourceContainers

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
private IContainer[] getSourceContainers(Element element) {
	String sourcePaths= element.getAttribute(SOURCEPATH);

	if (sourcePaths.endsWith(File.pathSeparator)) {
		sourcePaths += '.';
	}
	IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();

	ArrayList<IContainer> res= new ArrayList<IContainer>();

	String[] strings= sourcePaths.split(File.pathSeparator);
	for (int i= 0; i < strings.length; i++) {
		IPath path= makeAbsolutePathFromRelative(new Path(strings[i].trim()));
		if (path != null) {
			IContainer[] containers= root.findContainersForLocationURI(URIUtil.toURI(path.makeAbsolute()));
			for (int k= 0; k < containers.length; k++) {
				res.add(containers[k]);
			}
		}

	}
	return res.toArray(new IContainer[res.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavadocOptionsManager.java

示例10: createXML

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
public Element createXML(IJavaProject[] projects) throws CoreException {
	if (fAntpath.length() > 0) {
		try {
			IPath filePath= Path.fromOSString(fAntpath);
			IPath directoryPath= filePath.removeLastSegments(1);

			IPath basePath= null;
			IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
			if (root.findFilesForLocationURI(URIUtil.toURI(filePath.makeAbsolute())).length > 0) {
				basePath= directoryPath; // only do relative path if ant file is stored in the workspace
			}
			JavadocWriter writer= new JavadocWriter(basePath, projects);
			return writer.createXML(this);
		} catch (ParserConfigurationException e) {
			String message= JavadocExportMessages.JavadocOptionsManager_createXM_error;
			throw new CoreException(JavaUIStatus.createError(IStatus.ERROR, message, e));
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavadocOptionsManager.java

示例11: getTargetPath

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
/**
 * Returns the target path to be used for the updated classpath entry.
 *
 * @param entry
 *            the classpath entry
 * @return the target path, or <code>null</code>
 * @throws CoreException
 *             if an error occurs
 */
private IPath getTargetPath(final IClasspathEntry entry) throws CoreException {
	final URI location= getLocationURI(entry);
	if (location != null) {
		final URI target= getTargetURI(location);
		if (target != null) {
			IPath path= URIUtil.toPath(target);
			if (path != null) {
				final IPath workspace= ResourcesPlugin.getWorkspace().getRoot().getLocation();
				if (workspace.isPrefixOf(path)) {
					path= path.removeFirstSegments(workspace.segmentCount());
					path= path.setDevice(null);
					path= path.makeAbsolute();
				}
			}
			return path;
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:JarImportWizard.java

示例12: processLine

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
@Override
public boolean processLine(String line, ErrorParserManager eoParser) {

	Matcher seeAlsoMatcher = seeAlso.matcher(line);
	if (seeAlsoMatcher.matches()) {
		String message = seeAlsoMatcher.group();
		String path = seeAlsoMatcher.group(1);
		IPath externalPath = new Path(path);
		IFile[] foundFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(URIUtil.toURI(externalPath));
		IFile resource = foundFiles.length > 0 && foundFiles[0] != null && foundFiles[0].exists() ? foundFiles[0] : null;
		if (resource != null) {
			externalPath = null;
		}
		eoParser.generateExternalMarker(resource, lineNumber, message, IMarkerGenerator.SEVERITY_INFO, "", externalPath);
		return true;
	}

	return false;
}
 
开发者ID:rungemar,项目名称:cmake4cdt,代码行数:20,代码来源:CMakeErrorParserStdOut.java

示例13: getSourceFilePathFromEditorInput

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
private static IPath getSourceFilePathFromEditorInput(IEditorInput editorInput) {
	if (editorInput instanceof IURIEditorInput) {
		URI uri = ((IURIEditorInput) editorInput).getURI();
		if (uri != null) {
			IPath path = URIUtil.toPath(uri);
			if (path != null) {
				  return path;
			}
		}
	}

	if (editorInput instanceof IFileEditorInput) {
		IFile file = ((IFileEditorInput) editorInput).getFile();
		if (file != null) {
			return file.getLocation();
		}
	}

	if (editorInput instanceof ILocationProvider) {
		return ((ILocationProvider) editorInput).getPath(editorInput);
	}

	return null;
}
 
开发者ID:wangzw,项目名称:CppStyle,代码行数:25,代码来源:ClangFormatFormatter.java

示例14: getInputPath

import org.eclipse.core.filesystem.URIUtil; //导入依赖的package包/类
public IPath getInputPath( IEditorInput input )
{
	if ( input instanceof IURIEditorInput )
	{
		//return new Path( ( (IURIEditorInput) input ).getURI( ).getPath( ) );
		URI uri = ( (IURIEditorInput) input ).getURI( );
		if(uri == null && input instanceof IFileEditorInput)
			return ((IFileEditorInput)input).getFile( ).getFullPath( );
		IPath localPath = URIUtil.toPath( uri );
		String host = uri.getHost( );
		if ( host != null && localPath == null )
		{
			return new Path( host + uri.getPath( ) ).makeUNC( true );
		}
		return localPath;
	}
	if ( input instanceof IFileEditorInput )
	{
		return ( (IFileEditorInput) input ).getFile( ).getLocation( );
	}
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:23,代码来源:IDEFileReportProvider.java

示例15: setupLinkedResourceTarget

import org.eclipse.core.filesystem.URIUtil; //导入依赖的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.filesystem.URIUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。