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


Java IFile.getLocation方法代碼示例

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


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

示例1: execute

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	TreeSelection selection = (TreeSelection) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
	Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
	Object firstElement = selection.getFirstElement();
	
	if (firstElement instanceof IAdaptable)
       {
           IFile file = (IFile)((IAdaptable)firstElement).getAdapter(IFile.class);
           IPath path = file.getLocation();
           
           try {
           	//TODO fix
			SurveyGenerator.generateAll(path.toOSString(), path.toOSString());
			MessageDialog.openInformation(shell, "Success", "Code was generated successfully");
		} catch (Exception e) {
			//MessageDialog.openError(shell, "Error", e.getMessage());
			e.printStackTrace();
		}
       }
	return null;
}
 
開發者ID:TodorovicNikola,項目名稱:SurveyDSL,代碼行數:23,代碼來源:GenerateATLHandler.java

示例2: getExtensionScheme

import org.eclipse.core.resources.IFile; //導入方法依賴的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 "";
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:47,代碼來源:RegisterAllOCCIExtensionAction.java

示例3: getExtensionURI

import org.eclipse.core.resources.IFile; //導入方法依賴的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 "";
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:46,代碼來源:RegisterAllOCCIExtensionAction.java

示例4: getExtensionScheme

import org.eclipse.core.resources.IFile; //導入方法依賴的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 "";
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:55,代碼來源:RegenerateConnectorAction.java

示例5: getExtensionMetamodelURI

import org.eclipse.core.resources.IFile; //導入方法依賴的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 "";
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:51,代碼來源:RegenerateConnectorAction.java

示例6: getExtensionFactoryClass

import org.eclipse.core.resources.IFile; //導入方法依賴的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 "";
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:52,代碼來源:RegenerateConnectorAction.java


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