本文整理匯總了Java中org.eclipse.core.runtime.Path類的典型用法代碼示例。如果您正苦於以下問題:Java Path類的具體用法?Java Path怎麽用?Java Path使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Path類屬於org.eclipse.core.runtime包,在下文中一共展示了Path類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fix
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
private void fix(IMarker marker, IProgressMonitor monitor) {
MarkerResolutionGenerator.printAttributes (marker);
try {
String filepath = (String) marker.getAttribute(BuildPolicyConfigurationException.JAVAFILENAME);
int start = (int) marker.getAttribute(IMarker.CHAR_START);
int end = (int) marker.getAttribute(IMarker.CHAR_END);
IFile ifile = (IFile) ResourceManager.toResource(new Path(filepath));
ICompilationUnit cu = JavaCore.createCompilationUnitFrom(ifile);
String source = cu.getBuffer().getContents();
String part1 = source.substring(0,start);
String part2 = source.substring(end);
source = part1 + "value=\"" + resolutionMarkerDescription.getGenerator() + "\"" + part2;
final Document document = new Document(source);
cu.getBuffer().setContents(document.get());
cu.save(monitor, false);
} catch (Exception e) {
ResourceManager.logException(e);
}
}
示例2: getResourcesWithExtension
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
public ArrayList<String> getResourcesWithExtension(String ext, String containerName) {
ArrayList<String> ret = new ArrayList<String>();
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 prjLoc = new File(loc.toString());
Collection<File> res = FileUtils.listFiles(prjLoc, FileFilterUtils.suffixFileFilter(ext, IOCase.INSENSITIVE), TrueFileFilter.INSTANCE);
for (File file : res)
ret.add(file.getAbsolutePath());
}
return ret;
}
示例3: getEditorInput
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
@Override
public IEditorInput getEditorInput(Object element) {
if (element instanceof ILineBreakpoint) {
return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
}
IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(element.toString()));
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFile[] files = root.findFilesForLocationURI(fileStore.toURI());
if (files != null) {
for (IFile file : files) {
if (file.exists()) {
return new FileEditorInput(file);
}
}
}
return new FileStoreEditorInput(fileStore);
}
示例4: process
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
private boolean process(Object element, RenameArguments arguments) {
if (element instanceof IFile) {
originalFile = (IFile) element;
newName = arguments.getNewName();
if (!acceptFile(originalFile))
return false;
RenameChange operation = new RenameGraphFileChange(originalFile.getProject(),originalFile.getFullPath(), newName);
renameOperations.add(operation);
return true;
}
if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
MoveGraphParticipant mgp = new MoveGraphParticipant();
moveOperations.addAll(mgp.create(folder,(folder.getParent().getFolder(new Path(arguments.getNewName())))));
return moveOperations.size()>0;
}
return false;
}
示例5: ExportCommand
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
public ExportCommand(String containerName, String fileName, String fileType, String content) {
super();
this.containerName = containerName;
this.fileName = fileName;
this.fileType = fileType;
this.content = content;
wsRoot = ResourcesPlugin.getWorkspace().getRoot();
names = StringUtils.split(containerName, "/");
wsRootRes = wsRoot.findMember(new Path("/" + names[0]));
prj = wsRootRes.getProject();
target = prj.getFolder("target");
steps = prj.getFolder("target/Steps");
types = prj.getFolder("target/Steps/0-Types");
srvcs = prj.getFolder("target/Steps/1-Services");
cdef = prj.getFolder("target/Steps/2-ComponentDefinitions");
iassm = prj.getFolder("target/Steps/3-InitialAssembly");
cimpl = prj.getFolder("target/Steps/4-ComponentImplementations");
intgr = prj.getFolder("target/Steps/5-Integration");
}
示例6: getFile
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
/**
* @param projectname
* @param folder
* @param filename
* @return whether the file exists in the specified project & folder
* @throws CoreException
*/
public static File getFile(String projectname, String folder, String pkg, String filename) throws CoreException {
IProject project = getProject(projectname);
IFolder destFolder = project.getFolder(new Path(folder));
IFolder container = destFolder;
if (pkg != null) {
StringTokenizer st = new StringTokenizer(pkg, "/");
while (st.hasMoreTokens()) {
String dir = st.nextToken();
IFolder f = container.getFolder(new Path(dir));
if (!f.exists()) {
f.create(true, true, null);
}
container = f;
}
}
IFile file = container.getFile(new Path(filename));
return file.getRawLocation().makeAbsolute().toFile();
}
示例7: checkSubJobForExternalFiles
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
/**
* Check nested subjob to collect external files.
* @param externalFilesPathList
* @param subJobPath
* @param tranformComponentList
*/
private void checkSubJobForExternalFiles(List<String> externalFilesPathList,String subJobPath, List<String> tranformComponentList) {
Object obj=null;
try {
obj = CanvasUtils.INSTANCE.fromXMLToObject(new FileInputStream(new File(JobManager.getAbsolutePathFromFile(new Path(subJobPath)))));
} catch (FileNotFoundException e) {
logger.error("subjob xml not found "+e);
}
if(obj!=null && obj instanceof Container){
Container container = (Container) obj;
for (Component component : container.getUIComponentList()){
addExternalTransformFiles(externalFilesPathList, component, tranformComponentList);
Schema schema = (Schema) component.getProperties().get(Constants.SCHEMA_PROPERTY_NAME);
if(schema!=null && schema.getIsExternal()){
externalFilesPathList.add(schema.getExternalSchemaPath());
}
if(Constants.SUBJOB_COMPONENT.equals(component.getComponentName())){
String subJob=(String) component.getProperties().get(Constants.PATH_PROPERTY_NAME);
checkSubJobForExternalFiles(externalFilesPathList, subJob,tranformComponentList);
}
}
}
}
示例8: openModuleSpecifierDialog
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
/**
* Open the dialog to select a module specifier
*
* @param shell
* The Shell to open the dialog in
*/
public void openModuleSpecifierDialog(Shell shell) {
ModuleSpecifierSelectionDialog dialog = new ModuleSpecifierSelectionDialog(shell,
model.getProject().append(model.getSourceFolder()));
if (!model.getModuleSpecifier().isEmpty()) {
String initialSelectionSpecifier = model.getModuleSpecifier();
dialog.setInitialSelection(initialSelectionSpecifier);
}
dialog.open();
Object result = dialog.getFirstResult();
if (result instanceof String) {
IPath specifierPath = new Path((String) result);
model.setModuleSpecifier(specifierPath.removeFileExtension().toString());
}
}
示例9: testIndexing
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
/**
* Performance tests for search: Indexing entire workspace
*
* First wait that already started indexing jobs ends before performing test and measure.
* Consider this initial indexing jobs as warm-up for this test.
*/
public void testIndexing() throws CoreException {
// Wait for indexing end (we use initial indexing as warm-up)
AbstractJavaModelTests.waitUntilIndexesReady();
// Remove project previous indexing
INDEX_MANAGER.removeIndexFamily(new Path(""));
INDEX_MANAGER.reset();
// Restart brand new indexing
INDEX_MANAGER.request(new Measuring(true));
for (int j=0, length=ALL_PROJECTS.length; j<length; j++) {
if (DACAPO_PRINT) System.out.print(".");
INDEX_MANAGER.indexAll(ALL_PROJECTS[j].getProject());
}
waitUntilIndexesReady();
}
示例10: checkIfXPathIsDuplicate
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
private void checkIfXPathIsDuplicate( ) {
Text loopXpathQueryTextBox=(Text)table.getData();
String loopXPathQuery=loopXpathQueryTextBox.getText();
Set<Path> setToCheckDuplicates= new HashSet<Path>();
Set<String> uniqueName=new HashSet<>();
for(TableItem tableItem:table.getItems()){
Path xPathColumn=makeXPathAbsoluteIfNot(tableItem.getText(2), loopXPathQuery);
if(!uniqueName.add(tableItem.getText(0))){
tableItem.setData(Constants.ERROR_MESSAGE,FIELD_IS_DUPLICATE);
setRedColor(tableItem);
}
else if(!setToCheckDuplicates.add(xPathColumn)){
tableItem.setData(Constants.ERROR_MESSAGE,Messages.X_PATH_IS_DUPLICATE);
setRedColor(tableItem);
}
else{
tableItem.setData(Constants.ERROR_MESSAGE,"");
setBlackColor(tableItem);
}
}
}
示例11: getIFile
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
/**
* Getting an IFile from an EMF Resource
*
* @param eObject
* @return
*/
public static IFile getIFile(Resource res) {
URI uri = res.getURI();
String filePath = uri.toPlatformString(true);
IFile ifile = ResourcesPlugin.getWorkspace().getRoot()
.getFile(new Path(filePath));
return ifile;
}
示例12: getParentRepos
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
@Override
public Set<String> getParentRepos()
{
String parents;
try
{
parents = prefs.get(JPFClasspathPlugin.PREF_PARENT_REGISTRIES, "");
}
catch( IllegalStateException ise )
{
refreshPrefs();
parents = prefs.get(JPFClasspathPlugin.PREF_PARENT_REGISTRIES, "");
}
Path path = new Path(parents);
Set<String> parentSet = new HashSet<>();
for( String parentStr : path.segments() )
{
if( parentStr.length() > 0 )
{
parentSet.add(parentStr);
}
}
return parentSet;
}
示例13: testUpdatePathGeneratorInSourceFile
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
@Test
public void testUpdatePathGeneratorInSourceFile () throws CoreException, FileNotFoundException {
System.out.println("XXXXXXXXXXXXXXXXXXXX testUpdatePathGeneratorInSourceFile");
String expectedNewGenerator = "random(vertex_coverage(50))";
PetClinicProject.create (bot,gwproject); // At this step the generator is "random(edge_coverage(100))"
IFile veterinarien = PetClinicProject.getVeterinariensSharedStateImplFile(gwproject);
ICompilationUnit cu = JavaCore.createCompilationUnitFrom(veterinarien);
String oldGenerator = JDTManager.findPathGeneratorInGraphWalkerAnnotation(cu);
SourceHelper.updatePathGenerator(veterinarien, oldGenerator, expectedNewGenerator);
cu = JavaCore.createCompilationUnitFrom(veterinarien);
String newGenerator = JDTManager.findPathGeneratorInGraphWalkerAnnotation(cu);
assertEquals(newGenerator,expectedNewGenerator);
String location = JDTManager.getGW4EGeneratedAnnotationValue(cu,"value");
IPath path = new Path (gwproject).append(location);
IFile graphModel = (IFile)ResourceManager.getResource(path.toString());
IPath buildPolicyPath = ResourceManager.getBuildPoliciesPathForGraphModel(graphModel);
IFile buildPolicyFile = (IFile)ResourceManager.getResource(buildPolicyPath.toString());
PropertyValueCondition condition = new PropertyValueCondition(buildPolicyFile,graphModel.getName(),"random(edge_coverage(100));I;random(vertex_coverage(50));I;");
bot.waitUntil(condition);
}
示例14: validatePage
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
/**
* The framework calls this to see if the file is correct.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean validatePage ()
{
if ( super.validatePage () )
{
String extension = new Path ( getFileName () ).getFileExtension ();
if ( extension == null || !FILE_EXTENSIONS.contains ( extension ) )
{
String key = FILE_EXTENSIONS.size () > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$
setErrorMessage ( NextGenerationProtocolEditorPlugin.INSTANCE.getString ( key, new Object[] { FORMATTED_FILE_EXTENSIONS } ) );
return false;
}
return true;
}
return false;
}
示例15: validatePage
import org.eclipse.core.runtime.Path; //導入依賴的package包/類
/**
* The framework calls this to see if the file is correct.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected boolean validatePage ()
{
if ( super.validatePage () )
{
final String extension = new Path ( getFileName () ).getFileExtension ();
if ( extension == null || !FILE_EXTENSIONS.contains ( extension ) )
{
final String key = FILE_EXTENSIONS.size () > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; //$NON-NLS-1$ //$NON-NLS-2$
setErrorMessage ( ChartEditorPlugin.INSTANCE.getString ( key,
new Object[] { FORMATTED_FILE_EXTENSIONS } ) );
return false;
}
return true;
}
return false;
}