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


Java IFile.getName方法代碼示例

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


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

示例1: updateBuildPolicyFileFor

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * @param file
 */
public static void updateBuildPolicyFileFor(IFile file) {
	Job job = new WorkspaceJob("Updating Build Policies from " + file.getName()) {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			ICompilationUnit compilationUnit = JavaCore.createCompilationUnitFrom(file);
			if (compilationUnit != null) {
				if (JDTManager.isGraphWalkerExecutionContextClass(compilationUnit)) {
					updateBuildPolicyFileForCompilatioUnit(compilationUnit);
				}
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.setRule(file.getProject());
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:21,代碼來源:ResourceManager.java

示例2: execute

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IFile file = getSelectedFile();
	if (file==null){
		return null;
	}
	IWorkbenchPage page = EclipseUtil.getActivePage();
	if (page==null){
		return null;
	}
	try {
		page.openEditor(new FileEditorInput(file), BashEditor.EDITOR_ID);
	} catch (PartInitException e) {
		throw new ExecutionException("Was not able to open bash editor for file:"+file.getName(),e);
	}
	return null;
}
 
開發者ID:de-jcup,項目名稱:eclipse-bash-editor,代碼行數:18,代碼來源:OpenWithBashEditor.java

示例3: testUpdatePathGeneratorInSourceFile

import org.eclipse.core.resources.IFile; //導入方法依賴的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);
	}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:25,代碼來源:GW4EFixesTestCase.java

示例4: generateBug

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Launch an file, using the file information, which means using default launch configurations.
 */
protected void generateBug(IFile fileSelectedToRun) {
	String content = "";

	try {
		content = new String(Files.readAllBytes(Paths.get(fileSelectedToRun.getRawLocationURI())));
	} catch (IOException e) {
		throw new RuntimeException("Cannot read provided file " + fileSelectedToRun.getName(), e);
	}

	System.out.println(content);
	generateAndDisplayReport(fileSelectedToRun.getName(), content);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:16,代碼來源:GenerateXpectReportShortcut.java

示例5: rename

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * @param ifile
 * @param monitor
 * @throws JavaModelException
 */
public static void rename(IFile ifile, IProgressMonitor monitor) throws JavaModelException {
	if (!ifile.getName().endsWith(".java"))
		return;
	ICompilationUnit unit = JavaCore.createCompilationUnitFrom(ifile);
	String name = ifile.getName();
	String[] segments = name.split("\\.");

	name = segments[0] + System.currentTimeMillis() + "." + segments[1];
	unit.rename(name, false, monitor);
	unit.close();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:17,代碼來源:JDTManager.java

示例6: isJUnitResultFile

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static boolean isJUnitResultFile(IFile file) throws CoreException {
	String filename = file.getName();
	String extension = file.getFileExtension();
	if (filename.startsWith("TEST-GraphWalker-") && "xml".equalsIgnoreCase(extension)) {
		return true;
	}
	return false;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:9,代碼來源:ResourceManager.java

示例7: stripFileExtension

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Return the file name of the passed selection without its extension file,
 * if it is a file ...
 * 
 * @param selection
 * @return
 */
public static String stripFileExtension(IStructuredSelection selection) {
	Object obj = ((IStructuredSelection) selection).getFirstElement();
	if (!(obj instanceof IFile))
		return "";
	IFile file = ((IFile) obj);
	String extension = file.getFileExtension();
	String name = file.getName();
	int pos = name.indexOf("." + extension);
	return name.substring(0, pos);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:18,代碼來源:ResourceManager.java

示例8: testInvalidGeneratorInSourceFile

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Test
public void testInvalidGeneratorInSourceFile () throws CoreException, FileNotFoundException {
	System.out.println("XXXXXXXXXXXXXXXXXXXX testInvalidGeneratorInSourceFile");
	String expectedNewGenerator = "xxx";
	 
		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);
		
		GW4EProject project = new GW4EProject(bot, gwproject);
		project.cleanBuild(); 
		
		String expectedErrorMessageInProblemView = "Invalid path generator : '"+ expectedNewGenerator + "'";
	ProblemView pv = ProblemView.open(bot);
	List<ResolutionMarkerDescription> markers = PathGeneratorDescription.getDescriptions();
	 
	pv.executeQuickFixForErrorMessage(
			expectedErrorMessageInProblemView,
			markers.get(0).toString(), 
			new ICondition [] {new NoErrorInProblemView(pv)}
	);
	pv.close();//Mandatory
		
		String graphmlSourcePath = JDTManager.getGW4EGeneratedAnnotationValue(cu,"value");
		IPath path = new Path (gwproject).append(graphmlSourcePath);
		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(vertex_coverage(100));I;random(edge_coverage(100));I;");
	bot.waitUntil(condition);
	    
	}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:40,代碼來源:GW4EFixesTestCase.java

示例9: getGraphName

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Gets the graph name.
 *
 * @param outPutFile the out put file
 * @param externalOutputFile the external output file
 * @return the graph name
 */
private String getGraphName(IFile outPutFile, IFileStore externalOutputFile) {
	if (outPutFile != null && StringUtils.isNotBlank(outPutFile.getName()))
		return outPutFile.getName();
	else if (externalOutputFile != null && StringUtils.isNotBlank(externalOutputFile.getName()))
		return externalOutputFile.getName();
	else
		return "Temp.xml";
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:16,代碼來源:ConverterUtil.java

示例10: makeResourceItem

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private static ResourceItem makeResourceItem(IFile file) {
	return new ResourceItem(file.getName(), makePathOnly(file.getProjectRelativePath()), file.getProject().getName());
}
 
開發者ID:dakaraphi,項目名稱:eclipse-plugin-commander,代碼行數:4,代碼來源:EclipseWorkbench.java

示例11: createSimpleGraph

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static GWGraph createSimpleGraph(IFile file) {
	GWGraph gWGraph = new GWGraph(UUID.randomUUID(),file.getName(),UUID.randomUUID().toString());
	gWGraph.setFile(file);
	
	Vertex v1 = new StartVertex(gWGraph,UUID.randomUUID(),"v1",UUID.randomUUID().toString()) ;
	Vertex v2 = new Vertex(gWGraph,UUID.randomUUID(),"v2",UUID.randomUUID().toString()) ;
	Vertex v3 = new Vertex(gWGraph,UUID.randomUUID(),"v3",UUID.randomUUID().toString()) ;
	Vertex v4 = new Vertex(gWGraph,UUID.randomUUID(),"v4",UUID.randomUUID().toString()) ;
	Vertex v5 = new Vertex(gWGraph,UUID.randomUUID(),"v5",UUID.randomUUID().toString()) ;
	
	Vertex [] vertices = new Vertex [] {v1,v2,v3,v4,v5};
	for (int i = 0; i < vertices.length; i++) {
		VertexCreateCommand vcc  = new VertexCreateCommand ();
		vcc.setVertex(vertices[i]);
		vcc.setLocation(new Point(0,0));
		vcc.execute();
	}
 
	LinkCreateCommand lcc = new LinkCreateCommand ();
	lcc.setSource(v1);
	lcc.setTarget(v2);
	lcc.setGraph(gWGraph);
	lcc.setLink(new GWEdge(gWGraph,UUID.randomUUID(), "v1->v2",UUID.randomUUID().toString()));
	lcc.execute(); 
	
	lcc.setSource(v2);
	lcc.setTarget(v3);
	lcc.setGraph(gWGraph);
	lcc.setLink(new GWEdge(gWGraph,UUID.randomUUID(), "v2->v3",UUID.randomUUID().toString()));
	lcc.execute(); 

	lcc.setSource(v2);
	lcc.setTarget(v4);
	lcc.setGraph(gWGraph);
	lcc.setLink(new GWEdge(gWGraph,UUID.randomUUID(), "v2->v4",UUID.randomUUID().toString()));
	lcc.execute(); 
	
	lcc.setSource(v4);
	lcc.setTarget(v5);
	lcc.setGraph(gWGraph);
	lcc.setLink(new GWEdge(gWGraph,UUID.randomUUID(), "v4->v5",UUID.randomUUID().toString()));
	lcc.execute(); 

	lcc.setSource(v2);
	lcc.setTarget(v5);
	lcc.setGraph(gWGraph);
	lcc.setLink(new GWEdge(gWGraph,UUID.randomUUID(), "v2->v5",UUID.randomUUID().toString()));
	lcc.execute(); 

	lcc.setSource(v1);
	lcc.setTarget(v4);
	lcc.setGraph(gWGraph);
	lcc.setLink(new GWEdge(gWGraph,UUID.randomUUID(), "v1->v4",UUID.randomUUID().toString()));
	lcc.execute(); 

	
	return gWGraph;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:59,代碼來源:GraphTemplateFactory.java

示例12: testEnableDisableSynchronization

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Test
public void testEnableDisableSynchronization() throws CoreException, IOException, InterruptedException {
	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);
	
	GW4EProjectPreference gwpp = new GW4EProjectPreference(bot, gwproject);
	GW4EProjectProperties page = gwpp.openPropertiesPage( );
	
	page.toggleSynchronizationButton();
	page.ok();
	
	cu = JavaCore.createCompilationUnitFrom(veterinarien);
	oldGenerator = JDTManager.findPathGeneratorInGraphWalkerAnnotation(cu);
		SourceHelper.updatePathGenerator(veterinarien, oldGenerator, "random(edge_coverage(80))");
		cu = JavaCore.createCompilationUnitFrom(veterinarien);
		newGenerator = JDTManager.findPathGeneratorInGraphWalkerAnnotation(cu);
		
		// Nothing should have changed
		condition = new PropertyValueCondition(buildPolicyFile,graphModel.getName(),"random(edge_coverage(100));I;random(vertex_coverage(50));I;");
	bot.waitUntil(condition);

	page = gwpp.openPropertiesPage();
	page.toggleSynchronizationButton();
	page.ok();
	
	cu = JavaCore.createCompilationUnitFrom(veterinarien);
	oldGenerator = JDTManager.findPathGeneratorInGraphWalkerAnnotation(cu);
		SourceHelper.updatePathGenerator(veterinarien, oldGenerator, "random(edge_coverage(80))");
		cu = JavaCore.createCompilationUnitFrom(veterinarien);
		newGenerator = JDTManager.findPathGeneratorInGraphWalkerAnnotation(cu);
		
		
		//  should have changed
		try {
		condition = new PropertyValueCondition(buildPolicyFile,graphModel.getName(),"random(vertex_coverage(50));I;random(edge_coverage(80));I;");
		bot.waitUntil(condition);
	} catch (TimeoutException e) {
		condition = new PropertyValueCondition(buildPolicyFile,graphModel.getName(),"random(edge_coverage(80));I;random(vertex_coverage(50));I;");
		bot.waitUntil(condition);
	}
	}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:60,代碼來源:GW4EPreferenceProjectTestCase.java

示例13: execute

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final String filePath = getFilePath();
  if (filePath == null) {
    return null;
  }

  final IEditorPart editor = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
      .getActivePage().getActiveEditor();;

  if (editor == null) {
    return null;
  }

  if (editor.isDirty()) {
    final IFile file = ResourceUtil.getFile(editor.getEditorInput());
    final MessageDialog warningdialog =
        new MessageDialog(MarkerActivator.getShell(), "Save Specification", null,
            file.getName()
                + " has been modified. You must save file for update the specification. Do you want to save now?",
            MessageDialog.WARNING, new String[] {"Yes", "No"}, 0);
    if (warningdialog.open() != 0) {
      return null;
    }

    AlloyOtherSolutionReasoning.getInstance().finish();
    editor.doSave(new NullProgressMonitor());
  }

  final String content = getContent(filePath);
  if (content == null) {
    return null;
  }

  AlloyUtilities.updateSpec(filePath, content);

  try {
    TraceManager.get().loadSpec(filePath);
  } catch (final TraceException e) {
    e.printStackTrace();
  }

  final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Status Information",
      null, "Specification has been updated.", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
  dialog.open();

  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:49,代碼來源:UpdateSpecificationHandler.java


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