本文整理汇总了Java中com.intellij.util.net.NetUtils.getLocalHostString方法的典型用法代码示例。如果您正苦于以下问题:Java NetUtils.getLocalHostString方法的具体用法?Java NetUtils.getLocalHostString怎么用?Java NetUtils.getLocalHostString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.net.NetUtils
的用法示例。
在下文中一共展示了NetUtils.getLocalHostString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PydevXmlRpcClient
import com.intellij.util.net.NetUtils; //导入方法依赖的package包/类
/**
* Constructor (see fields description)
*/
public PydevXmlRpcClient(Process process, int port) throws MalformedURLException {
XmlRpc.setDefaultInputEncoding("UTF8"); //even though it uses UTF anyway
impl = new XmlRpcClientLite(NetUtils.getLocalHostString(), port);
//this.impl = new XmlRpcClient(url, new CommonsXmlRpcTransportFactory(url));
this.process = process;
}
示例2: createProcessHandler
import com.intellij.util.net.NetUtils; //导入方法依赖的package包/类
private void createProcessHandler() {
// Make sure we have a node interpreter
final String nodeInterpreter = getNodeInterpreter(project);
if (nodeInterpreter == null) {
if(log.isDebugEnabled()) {
log.debug("Can't create process handler: No Node.js interpreter configured.");
}
return;
}
try {
if(log.isDebugEnabled()) {
log.debug("Resolving node.js file...");
}
final File jsGraphQLNodeFile = getOrCreateJSGraphQLLanguageServiceFileName();
if(jsGraphQLNodeFile == null) {
if(log.isDebugEnabled()) {
log.debug("Can't create process handler: Got null from getOrCreateJSGraphQLLanguageServiceFileName.");
}
return;
}
final int socketPort = NetUtils.findAvailableSocketPort();
final GeneralCommandLine commandLine = new GeneralCommandLine(nodeInterpreter);
commandLine.withWorkDirectory(jsGraphQLNodeFile.getParent());
commandLine.addParameter(jsGraphQLNodeFile.getAbsolutePath());
commandLine.addParameter("--port=" + socketPort);
if(log.isDebugEnabled()) {
log.debug("Creating processHandler using command line " + commandLine.toString());
}
processHandler = new OSProcessHandler(commandLine);
JSGraphQLLanguageUIProjectService languageService = JSGraphQLLanguageUIProjectService.getService(project);
final Runnable onInitialized = languageService.connectToProcessHandler(processHandler);
if (waitForListeningNotification(processHandler, project)) {
url = new URL("http", NetUtils.getLocalHostString(), socketPort, JSGRAPHQL_LANGUAGE_SERVICE_MAPPING);
onInitialized.run();
} else {
log.error("Unable to start JS GraphQL Language Service using Node.js with commandline " + commandLine.toString());
}
} catch (IOException | ExecutionException e) {
if (e instanceof ProcessNotCreatedException) {
Notifications.Bus.notify(new Notification("GraphQL", "Unable to start JS GraphQL Language Service", "Node.js was not started: " + e.getMessage(), NotificationType.ERROR));
} else {
log.error("Error running JS GraphQL Language Service using Node.js", e);
}
}
}
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:59,代码来源:JSGraphQLNodeLanguageServiceInstance.java