本文整理汇总了Java中org.eclipse.core.runtime.IPath.toFile方法的典型用法代码示例。如果您正苦于以下问题:Java IPath.toFile方法的具体用法?Java IPath.toFile怎么用?Java IPath.toFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.IPath
的用法示例。
在下文中一共展示了IPath.toFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertyChanged
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public void propertyChanged(Object source, int propId) {
// When a property from the xslEditor Changes, walk the list all the listeners and notify them.
Object listeners[] = listenerList.getListeners();
for (int i = 0; i < listeners.length; i++) {
IPropertyListener listener = (IPropertyListener) listeners[i];
listener.propertyChanged(this, propId);
}
if (propId == IEditorPart.PROP_DIRTY) {
if (!xmlEditor.isDirty()) {
// We changed from Dirty to non dirty ==> User has saved so,
// launch Convertigo engine
// "touch" the parent style sheet ==> Convertigo engine will
// recompile it
IPath path;
path = file.getRawLocation();
path = path.append("../../" + parentStyleSheetUrl);
File parentFile = path.toFile();
parentFile.setLastModified(System.currentTimeMillis());
}
}
}
示例2: loadSchemaFromExternalFile
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
**
* This methods loads schema from external schema file
*
* @param externalSchemaFilePath
* @param schemaType
* @return
*/
public List<GridRow> loadSchemaFromExternalFile(String externalSchemaFilePath,String schemaType) {
IPath filePath=new Path(externalSchemaFilePath);
IPath copyOfFilePath=filePath;
if (!filePath.isAbsolute()) {
filePath = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath).getRawLocation();
}
if(filePath!=null && filePath.toFile().exists()){
GridRowLoader gridRowLoader=new GridRowLoader(schemaType, filePath.toFile());
return gridRowLoader.importGridRowsFromXML();
}else{
MessageBox messageBox=new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR);
messageBox.setMessage(Messages.FAILED_TO_IMPORT_SCHEMA_FILE+"\n"+copyOfFilePath.toString());
messageBox.setText(Messages.ERROR);
messageBox.open();
}
return null;
}
示例3: getExistingFileInTheSameFolder
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
/**
* Return a file named postfix in the same folder as the passed resource
* Fails if the file does not exist
*
* @param resource
* @param postfix
* @return
* @throws FileNotFoundException
*/
public static File getExistingFileInTheSameFolder(IFile resource, String postfix) throws FileNotFoundException {
if ((resource == null) || resource.getParent() == null) {
throw new FileNotFoundException(String.valueOf(resource) + " " + postfix);
}
IPath path = resource.getParent().getRawLocation().append(postfix);
File file = path.toFile();
if (!file.exists()) {
throw new FileNotFoundException("Expecting a " + postfix + " file in " + resource.getParent().getFullPath()
+ " including " + resource.getFullPath());
}
return file;
}
示例4: getStorageDirectory
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private File getStorageDirectory() {
Activator plugin = Activator.getDefault();
if (plugin != null) {
//The plug-in instance can be null at shutdown, when the plug-in is stopped.
IPath path = plugin.getStateLocation();
File file = new File(path.toFile(), "events"); //$NON-NLS-1$
if (!file.exists()) {
file.mkdirs();
}
return file;
} else {
return null;
}
}
示例5: importParamterFileToProject
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private boolean importParamterFileToProject(String[] listOfFilesToBeImported, String source,String destination, ParamterFileTypes paramterFileTypes) {
for (String fileName : listOfFilesToBeImported) {
String absoluteFileName = source + fileName;
IPath destinationIPath=new Path(destination);
destinationIPath=destinationIPath.append(fileName);
File destinationFile=destinationIPath.toFile();
try {
if (!ifDuplicate(listOfFilesToBeImported, paramterFileTypes)) {
if (StringUtils.equalsIgnoreCase(absoluteFileName, destinationFile.toString())) {
return true;
} else if (destinationFile.exists()) {
int returnCode = doUserConfirmsToOverRide();
if (returnCode == SWT.YES) {
FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
} else if (returnCode == SWT.NO) {
return true;
} else {
return false;
}
} else {
FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
}
}
} catch (IOException e1) {
if(StringUtils.endsWithIgnoreCase(e1.getMessage(), ErrorMessages.IO_EXCEPTION_MESSAGE_FOR_SAME_FILE)){
return true;
}
MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
messageBox.setText(MessageType.ERROR.messageType());
messageBox.setMessage(ErrorMessages.UNABLE_TO_POPULATE_PARAM_FILE + " " + e1.getMessage());
messageBox.open();
logger.error("Unable to copy prameter file in current project work space");
return false;
}
}
return true;
}
示例6: getAbsolutePathForJars
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
public static String getAbsolutePathForJars(IPath iPath) {
String absolutePath = iPath.toString();
File file = iPath.toFile();
if (!file.exists()) {
String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
absolutePath = workspacePath + iPath.toString();
}
return absolutePath;
}
示例7: getExtensionScheme
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
@SuppressWarnings("unlikely-arg-type")
private String getExtensionScheme(IFile pluginXML) {
try {
IPath location = pluginXML.getLocation();
if (location != null) {
File file = location.toFile();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(file);
if (doc.hasChildNodes()) {
NodeList nodeList = doc.getChildNodes();
for (int count = 0; count < nodeList.getLength(); count++) {
Node tempNode = nodeList.item(count);
if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode.getNodeName().equals("plugin")) {
for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
Node tempNode1 = tempNode.getChildNodes().item(count1);
if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode1.getNodeName().equals("extension")) {
//System.out.println(" tempNode1 "+tempNode1.getAttributes().getNamedItem("point"));
String obj = "org.eclipse.emf.ecore.uri_mapping";
if (tempNode1.getAttributes().getNamedItem("point").getNodeValue().equals(obj)) {
for (int count2 = 0; count2 < tempNode1.getChildNodes().getLength(); count2++) {
Node tempNode2 = tempNode1.getChildNodes().item(count2);
if (tempNode2.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode2.getNodeName().equals("mapping")) {
return tempNode2.getAttributes().getNamedItem("source").getNodeValue().concat("#");
}
}
}
}
}
}
}
}
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
示例8: getExtensionURI
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private String getExtensionURI(IFile pluginXML) {
try {
IPath location = pluginXML.getLocation();
if (location != null) {
File file = location.toFile();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(file);
if (doc.hasChildNodes()) {
NodeList nodeList = doc.getChildNodes();
for (int count = 0; count < nodeList.getLength(); count++) {
Node tempNode = nodeList.item(count);
if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode.getNodeName().equals("plugin")) {
for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
Node tempNode1 = tempNode.getChildNodes().item(count1);
if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode1.getNodeName().equals("extension")) {
//System.out.println(" tempNode1 "+tempNode1.getAttributes().getNamedItem("point"));
String obj = "org.eclipse.emf.ecore.uri_mapping";
if (tempNode1.getAttributes().getNamedItem("point").getNodeValue().equals(obj)) {
for (int count2 = 0; count2 < tempNode1.getChildNodes().getLength(); count2++) {
Node tempNode2 = tempNode1.getChildNodes().item(count2);
if (tempNode2.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode2.getNodeName().equals("mapping")) {
return tempNode2.getAttributes().getNamedItem("target").getNodeValue().replaceFirst("platform:/plugin/", "platform:/resource/");
}
}
}
}
}
}
}
}
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
示例9: getExtensionScheme
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private String getExtensionScheme(IFile pluginXML) {
try {
IPath location = pluginXML.getLocation();
if (location != null) {
File file = location.toFile();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(file);
if (doc.hasChildNodes()) {
NodeList nodeList = doc.getChildNodes();
for (int count = 0; count < nodeList.getLength(); count++) {
Node tempNode = nodeList.item(count);
if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode.getNodeName().equals("plugin")) {
for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
Node tempNode1 = tempNode.getChildNodes().item(count1);
if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode1.getNodeName().equals("extension")) {
for (int count11 = 0; count11 < tempNode1.getChildNodes()
.getLength(); count11++) {
Node tempNode11 = tempNode1.getChildNodes().item(count11);
if (tempNode11.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode11.getNodeName().equals("factory")) {
if (tempNode11.hasAttributes()) {
NamedNodeMap nodeMap = tempNode11.getAttributes();
for (int i = 0; i < nodeMap.getLength(); i++) {
Node node = nodeMap.item(i);
if (node.getNodeName().equals("uri")) {
return node.getNodeValue()
.substring(0,
node.getNodeValue().length()
- ("/ecore".length()))
.concat("#");
}
}
}
}
}
}
}
}
}
}
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
示例10: getExtensionMetamodelURI
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private String getExtensionMetamodelURI(IFile pluginXML) {
try {
IPath location = pluginXML.getLocation();
if (location != null) {
File file = location.toFile();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(file);
if (doc.hasChildNodes()) {
NodeList nodeList = doc.getChildNodes();
for (int count = 0; count < nodeList.getLength(); count++) {
Node tempNode = nodeList.item(count);
if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode.getNodeName().equals("plugin")) {
for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
Node tempNode1 = tempNode.getChildNodes().item(count1);
if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode1.getNodeName().equals("extension")) {
for (int count11 = 0; count11 < tempNode1.getChildNodes()
.getLength(); count11++) {
Node tempNode11 = tempNode1.getChildNodes().item(count11);
if (tempNode11.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode11.getNodeName().equals("factory")) {
if (tempNode11.hasAttributes()) {
NamedNodeMap nodeMap = tempNode11.getAttributes();
for (int i = 0; i < nodeMap.getLength(); i++) {
Node node = nodeMap.item(i);
if (node.getNodeName().equals("uri")) {
return node.getNodeValue();
}
}
}
}
}
}
}
}
}
}
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
示例11: getExtensionFactoryClass
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
private String getExtensionFactoryClass(IFile pluginXML) {
try {
IPath location = pluginXML.getLocation();
if (location != null) {
File file = location.toFile();
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(file);
if (doc.hasChildNodes()) {
NodeList nodeList = doc.getChildNodes();
for (int count = 0; count < nodeList.getLength(); count++) {
Node tempNode = nodeList.item(count);
if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode.getNodeName().equals("plugin")) {
for (int count1 = 0; count1 < tempNode.getChildNodes().getLength(); count1++) {
Node tempNode1 = tempNode.getChildNodes().item(count1);
if (tempNode1.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode1.getNodeName().equals("extension")) {
for (int count11 = 0; count11 < tempNode1.getChildNodes()
.getLength(); count11++) {
Node tempNode11 = tempNode1.getChildNodes().item(count11);
if (tempNode11.getNodeType() == Node.ELEMENT_NODE) {
if (tempNode11.getNodeName().equals("factory")) {
if (tempNode11.hasAttributes()) {
NamedNodeMap nodeMap = tempNode11.getAttributes();
for (int i = 0; i < nodeMap.getLength(); i++) {
Node node = nodeMap.item(i);
if (node.getNodeName().equals("class")) {
String[] args = node.getNodeValue().split("\\.");
return args[args.length - 1];
}
}
}
}
}
}
}
}
}
}
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
示例12: getAvroSchema
import org.eclipse.core.runtime.IPath; //导入方法依赖的package包/类
protected AvroSchema getAvroSchema() {
IPathEditorInput pathInput = (IPathEditorInput) getEditorInput();
IPath path = pathInput.getPath();
File file = path.toFile();
return new AvroSchemaFile(file);
}