本文整理汇总了Java中org.eclipse.core.runtime.IPath.toOSString方法的典型用法代码示例。如果您正苦于以下问题:Java IPath.toOSString方法的具体用法?Java IPath.toOSString怎么用?Java IPath.toOSString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.IPath
的用法示例。
在下文中一共展示了IPath.toOSString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFinalAssemblyDefinition
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public CompositeNode getFinalAssemblyDefinition(String name, String containerName) {
CompositeNode ret = null;
if (containerName != null) {
String[] names = StringUtils.split(containerName, "/");
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
IResource resource = wsRoot.findMember(new Path("/" + names[0]));
IPath loc = resource.getLocation();
File file = new File(loc.toOSString() + File.separator + name + ".fassmbl");
try {
ret = ParseUtil.getFinalAssemblyNodeFromText(FileUtils.readFileToString(file));
} catch (IOException e) {
EclipseUtil.writeStactTraceToConsole(e);
}
}
return ret;
}
示例2: getLogicalSystemDefinition
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public LogicalSystemNode getLogicalSystemDefinition(String name, String containerName) {
LogicalSystemNode ret = null;
if (containerName != null) {
String[] names = StringUtils.split(containerName, "/");
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
IResource resource = wsRoot.findMember(new Path("/" + names[0]));
IPath loc = resource.getLocation();
File file = new File(loc.toOSString() + File.separator + name + ".lsys");
try {
ret = ParseUtil.getLogicalSystemNodeFromText(FileUtils.readFileToString(file));
} catch (IOException e) {
EclipseUtil.writeStactTraceToConsole(e);
}
}
return ret;
}
示例3: getComponentImplementationDefinition
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public ComponentImplementationNode getComponentImplementationDefinition(String name, String containerName) {
ComponentImplementationNode ret = null;
if (containerName != null) {
String[] names = StringUtils.split(containerName, "/");
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
IResource resource = wsRoot.findMember(new Path("/" + names[0]));
IPath loc = resource.getLocation();
File file = new File(loc.toOSString() + File.separator + name + ".cimpl");
try {
ret = ParseUtil.getComponentImplementationNodeFromText(FileUtils.readFileToString(file));
} catch (IOException e) {
EclipseUtil.writeStactTraceToConsole(e);
}
}
return ret;
}
示例4: addBreakpointToMap
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private void addBreakpointToMap(IBreakpoint breakpoint) throws CoreException {
Assert.isTrue(supportsBreakpoint(breakpoint) && breakpoint instanceof ILineBreakpoint);
if (breakpoint instanceof ILineBreakpoint) {
ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
IResource resource = lineBreakpoint.getMarker().getResource();
IPath location = resource.getLocation();
String path = location.toOSString();
String name = location.lastSegment();
int lineNumber = lineBreakpoint.getLineNumber();
Source source = new Source().setName(name).setPath(path);
List<SourceBreakpoint> sourceBreakpoints = targetBreakpoints.computeIfAbsent(source,
s -> new ArrayList<>());
sourceBreakpoints.add(new SourceBreakpoint().setLine(lineNumber));
}
}
示例5: deleteBreakpointFromMap
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private void deleteBreakpointFromMap(IBreakpoint breakpoint) throws CoreException {
Assert.isTrue(supportsBreakpoint(breakpoint) && breakpoint instanceof ILineBreakpoint);
if (breakpoint instanceof ILineBreakpoint) {
ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
IResource resource = lineBreakpoint.getMarker().getResource();
IPath location = resource.getLocation();
String path = location.toOSString();
String name = location.lastSegment();
int lineNumber = lineBreakpoint.getLineNumber();
for (Entry<Source, List<SourceBreakpoint>> entry : targetBreakpoints.entrySet()) {
Source source = entry.getKey();
if (Objects.equals(name, source.name) && Objects.equals(path, source.path)) {
List<SourceBreakpoint> bps = entry.getValue();
for (Iterator<SourceBreakpoint> iterator = bps.iterator(); iterator.hasNext();) {
SourceBreakpoint sourceBreakpoint = (SourceBreakpoint) iterator.next();
if (Objects.equals(lineNumber, sourceBreakpoint.line)) {
iterator.remove();
}
}
}
}
}
}
示例6: getSchemaFile
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private java.io.File getSchemaFile(String externalSchemaPath) {
java.io.File schemaFile = null;
IPath location = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(externalSchemaPath)).getLocation();
if (location != null) {
if (!(location.toOSString().endsWith(SCHEMA_FILE_EXTENSION))
&& !(location.toOSString().endsWith(XML_FILE_EXTENSION))) {
schemaFile = new java.io.File(location.toOSString().concat(SCHEMA_FILE_EXTENSION));
} else {
schemaFile = new java.io.File(location.toOSString());
}
}
return schemaFile;
}
示例7: visit
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
* Answers whether children should be visited.
* <p>
* If the associated resource is a class file which has been changed, record it.
* </p>
*/
@Override
public boolean visit(IResourceDelta delta) {
if (delta == null || 0 == (delta.getKind() & IResourceDelta.CHANGED)) {
return false;
}
IResource resource = delta.getResource();
if (resource != null) {
switch (resource.getType()) {
case IResource.FILE:
if (0 == (delta.getFlags() & IResourceDelta.CONTENT)) {
return false;
}
if (CLASS_FILE_EXTENSION.equals(resource.getFullPath().getFileExtension())) {
IPath localLocation = resource.getLocation();
if (localLocation != null) {
String path = localLocation.toOSString();
IClassFileReader reader = ToolFactory.createDefaultClassFileReader(path,
IClassFileReader.CLASSFILE_ATTRIBUTES);
if (reader != null) {
// this name is slash-delimited
String qualifiedName = new String(reader.getClassName());
boolean hasBlockingErrors = false;
try {
// If the user doesn't want to replace
// classfiles containing
// compilation errors, get the source
// file associated with
// the class file and query it for
// compilation errors
IJavaProject pro = JavaCore.create(resource.getProject());
ISourceAttribute sourceAttribute = reader.getSourceFileAttribute();
String sourceName = null;
if (sourceAttribute != null) {
sourceName = new String(sourceAttribute.getSourceFileName());
}
IResource sourceFile = getSourceFile(pro, qualifiedName, sourceName);
if (sourceFile != null) {
IMarker[] problemMarkers = null;
problemMarkers = sourceFile.findMarkers(
IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true,
IResource.DEPTH_INFINITE);
for (IMarker problemMarker : problemMarkers) {
if (problemMarker.getAttribute(IMarker.SEVERITY,
-1) == IMarker.SEVERITY_ERROR) {
hasBlockingErrors = true;
break;
}
}
}
} catch (CoreException e) {
logger.log(Level.SEVERE, "Failed to visit classes: " + e.getMessage(), e);
}
if (!hasBlockingErrors) {
changedFiles.add(resource);
// dot-delimit the name
fullyQualifiedNames.add(qualifiedName.replace('/', '.'));
}
}
}
}
return false;
default:
return true;
}
}
return true;
}