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


Java File类代码示例

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


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

示例1: updatedExternalSchema

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
/**
 * This method update schema of component. for all selectedJobFiles.
 */
private void updatedExternalSchema(List<File> selectedJobFiles) {

	LOGGER.debug("Updating external schema");
	for (File file : selectedJobFiles) {

		Container container = null;
		try {
			container = (Container) CanvasUtils.INSTANCE.fromXMLToObject(file.getContents());
		} catch (CoreException e) {
			LOGGER.error("Error while converting job file to container.");
		}
		if (container != null) {
			List<Component> externalSchemaComps = getExternalSchemaComponent(container.getUIComponentList());
			updateExternalSchema(container, externalSchemaComps, file);
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:21,代码来源:ExternalSchemaUpdaterHandler.java

示例2: saveJob

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
private void saveJob(Container container, File file) {
	LOGGER.debug("Saving the job");
	ByteArrayOutputStream outStream = new ByteArrayOutputStream();
	CanvasUtils.INSTANCE.fromObjectToXML(container, outStream);
	try {
		file.setContents(new ByteArrayInputStream(outStream.toByteArray()), true, false, null);
		// Temp Fix if job already open need to reopen it to get
		// updated data (use setInput).
		if (closeEditorIfAlreadyOpen(file.getFullPath(), file.getName())) {
			openJob(file);
		}
		LOGGER.debug("Jon not open");
	} catch (CoreException e) {
		LOGGER.debug("Exception while saving job.");
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:ExternalSchemaUpdaterHandler.java

示例3: count

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
protected void count()
{
    java.io.InputStream is = null;
    try
    {
        is = ((File)file).getContents();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        for(String line = reader.readLine(); line != null; line = reader.readLine())
        {
            style = 2;
            parseLine(line.trim(), true);
            increase();
        }

        reader.close();
    }
    catch(Exception exception) { }
    numTN = numTM + numTC;
    numTL = numTM + numTC + numTB;
}
 
开发者ID:qxo,项目名称:eclipse-code-lines-plugin,代码行数:21,代码来源:ProfileCountUnit.java

示例4: count

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
protected void count()
{
    java.io.InputStream is = null;
    try
    {
        is = ((File)file).getContents();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        for(String line = reader.readLine(); line != null; line = reader.readLine())
        {
            style = 4;
            parseLine(line.trim(), true);
            increase();
        }

        reader.close();
    }
    catch(Exception exception) { }
    numTM = numJD + numMM + numSM;
    numTN = numTM + numTC;
    numTL = numTN + numTB;
}
 
开发者ID:qxo,项目名称:eclipse-code-lines-plugin,代码行数:22,代码来源:JavaCountUnit.java

示例5: execute

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	// get Model Path
	ITreeSelection treeSelection = (ITreeSelection) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
			.getSelectionService().getSelection();
	File file = (File) treeSelection.getFirstElement();

	modelPath = "platform:/resource" + file.getFullPath().toString();

	// load Settings, if there are any
	loadSettings();

	// open Wizard with ModelPath, Path and language as parameter
	SensidlWizard swizard = new SensidlWizard(modelPath, path, language, null);
	SensidlWizardDialog dialog = new SensidlWizardDialog(HandlerUtil.getActiveShell(event), swizard);
	dialog.open();

	return null;
}
 
开发者ID:SENSIDL-PROJECT,项目名称:SensIDL,代码行数:21,代码来源:ContextMenuHandler.java

示例6: updateExternalSchema

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
private void updateExternalSchema(Container container, List<Component> externalSchemaComps, File file) {
	for (Component component : externalSchemaComps) {
		Schema schema = (Schema) component.getProperties().get(Constants.SCHEMA);
		// May be the job not open so need to load property file.
		Utils.INSTANCE.loadProperties(file);
		String externalSchemaPath = schema.getExternalSchemaPath();

		if (ParameterUtil.containsParameter(externalSchemaPath, '/')) {
			externalSchemaPath = Utils.INSTANCE.getParamValue(externalSchemaPath);
			if ("Parameter is not Found!".equals(externalSchemaPath)) {
				LOGGER.error("Parameter '" + externalSchemaPath
						+ "' not found for loading external schema. Please check param file.");
				return;
			}
		}
		java.io.File schemaFile = getSchemaFile(externalSchemaPath);
		if (schemaFile != null && schemaFile.exists()) {
			schema.getGridRow().clear();
			ConverterUiHelper converterUiHelper = new ConverterUiHelper(component);
			List<GridRow> gridRows = converterUiHelper.loadSchemaFromExternalFile(schemaFile.getPath(),
					component.getGridRowType());
			schema.setGridRow(gridRows);
			updateComponentOutputSchema(component, gridRows);
		}
	}
	ImportedSchemaPropagation.INSTANCE.initiateSchemaPropagationAfterImport(container, true);
	saveJob(container, file);
	updateSchemaToSubJob(container);
	// Need to re-propagate after sub-job propagation.
	ImportedSchemaPropagation.INSTANCE.initiateSchemaPropagationAfterImport(container, true);
	saveJob(container, file);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:33,代码来源:ExternalSchemaUpdaterHandler.java

示例7: openJob

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
private void openJob(File file) {
	IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	if (activePage != null && file.exists()) {
		try {
			if (IDE.openEditor(activePage, file) == null) {
				LOGGER.debug("Enable to open");
			}
		} catch (PartInitException e) {
			LOGGER.debug("Exception while opening job");
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:13,代码来源:ExternalSchemaUpdaterHandler.java

示例8: getSchemaFile

import org.eclipse.core.internal.resources.File; //导入依赖的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;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:14,代码来源:ExternalSchemaUpdaterHandler.java

示例9: execute

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {

	List<File> selectedJobFile = getSelectedJobFile();
	if (selectedJobFile.size() > 0) {
		updatedExternalSchema(selectedJobFile);
	}
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:10,代码来源:ExternalSchemaUpdaterHandler.java

示例10: getSelectedJobFile

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
private List<File> getSelectedJobFile() {
	List<File> selectedJobFiles = new ArrayList<>();
	ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
	ISelection selection = selectionService.getSelection(HYDROGRAPH_PROJECT_NAVIGATOR_ID);
	if (selection instanceof ITreeSelection) {
		List selectionFiles = ((ITreeSelection) selection).toList();
		selectedJobFiles = getSelectedJobFile(selectionFiles);
	}
	return selectedJobFiles;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:11,代码来源:ExternalSchemaUpdaterHandler.java

示例11: count

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
protected void count()
{
    java.io.InputStream is = null;
    try
    {
        is = ((File)file).getContents();
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        for(String line = reader.readLine(); line != null; line = reader.readLine())
            parseLine(line.trim());

        reader.close();
    }
    catch(Exception exception) { }
    numTL = numTN + numTB;
}
 
开发者ID:qxo,项目名称:eclipse-code-lines-plugin,代码行数:16,代码来源:OtherCountUnit.java

示例12: createFile

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
private static File createFile(IPath workspaceRelativeAbsPathOfFile, String contents) throws CoreException {
  // TODO: Convert to ResouceUtils.createFile
  Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace();
  File file = (File) workspace.newResource(workspaceRelativeAbsPathOfFile, IResource.FILE);
  ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(contents.getBytes());
  file.create(byteArrayInputStream, false, null);
  JobsUtilities.waitForIdle();
  return file;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:10,代码来源:AbstractGWTPluginTestCase.java

示例13: buildSVGFromDot

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
private SVGDocument buildSVGFromDot(NotationElement notationElement) {
		StringBuilder dotGraph = new StringBuilder();
		dotGraph.append("graph ").append(notationElement.getId()).append(" {\n rankdir=\"LR\";\n");
		DotNotationBuilder dotBuilder = new DotNotationBuilder();
		dotGraph.append(dotBuilder.create(notationElement));
		dotGraph.append(" }\n");
		Document doc = null;

		String fullPath;
		if (inCDO) {
			String loc = "file:/" + System.getProperty("java.io.tmpdir") + "temp.svg";
			fullPath = loc.replaceAll("\\\\", "/");
		} else {
			fullPath = Controller.INSTANCE.getEcoreModel().eResource().getURI().toFileString()+".svg";
		}
		
		try {
			ByteArrayInputStream input = new ByteArrayInputStream(dotGraph.toString().getBytes());
			//		GraphViz.generate(input, "svg", new Point(200, 200), new Path(Controller.INSTANCE.getEcoreModel().eResource().getURI().toFileString()+".svg"));
			runDot(input, new Path(fullPath));
//			String svgLocation = Controller.INSTANCE.getEcoreModel().eResource().getURI().toString() + ".svg";
			String parser = XMLResourceDescriptor.getXMLParserClassName();
			SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
			if (inCDO) {
				doc = f.createDocument(fullPath);
			} else {
				java.io.File file = new java.io.File(fullPath);
				doc = f.createDocument(file.toURL().toString());
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

		return (SVGDocument) doc;
	}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:36,代码来源:NotationView.java

示例14: runDot

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
private void runDot(ByteArrayInputStream input, IPath outputLocation) {
	MultiStatus status = new MultiStatus(GraphVizActivator.ID, 0, "Errors occurred while running Graphviz", null);
	java.io.File dotInput = null;
	java.io.File dotOutput = outputLocation.toFile();
	try {
		// determine the temp input location
		dotInput = java.io.File.createTempFile("graphviz", ".dot");
		// dump the contents from the input stream into the temporary file
		// to be submitted to dot
		FileOutputStream tmpDotOutputStream = null;
		try {
			tmpDotOutputStream = new FileOutputStream(dotInput);
			IOUtils.copy(input, tmpDotOutputStream);
		} finally {
			IOUtils.closeQuietly(tmpDotOutputStream);
		}
		String absolutePath;
		if (outputLocation.isAbsolute()) {
			absolutePath = dotOutput.getPath().replaceFirst("file:\\\\", "");
		} else {
			absolutePath = dotOutput.getAbsolutePath();
		}
		IStatus result = GraphViz.runDot("-Tsvg", "-Gsize=200,200", "-o"+absolutePath, dotInput.getAbsolutePath() );
		if (dotOutput.isFile()) {
			// success!
			return;
		}
	} catch (IOException e) {
		status.add(new Status(IStatus.ERROR, GraphVizActivator.ID, "", e));
	} finally {
		dotInput.delete();
		IOUtils.closeQuietly(input);
	}
}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:35,代码来源:NotationView.java

示例15: run

import org.eclipse.core.internal.resources.File; //导入依赖的package包/类
public void run(IAction action) {
	if (action instanceof ObjectPluginAction) {
		ISelection selection = ((ObjectPluginAction)action).getSelection();
		if (selection instanceof TreeSelection) {
			Object element = ((TreeSelection)selection).getFirstElement();
			if (element instanceof File) {
				//TODO there should be a check here to see if the file has unsaved changes and to ask the user if they would
				//	like to save or tell them to save if they want to run tests on modified model
				IPath testFilePath = ((File)element).getFullPath(); //getRawLocation();
				run(testFilePath);
			}
		}
	}
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:15,代码来源:SadlActionDelegate.java


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