• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BuiltInServerManager类的典型用法和代码示例

java 1次浏览

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

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

示例1: getUrls

点赞 3

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
@NotNull
public static List<Url> getUrls(@NotNull VirtualFile file, @NotNull Project project, @Nullable String currentAuthority) {
  if (currentAuthority != null && !compareAuthority(currentAuthority)) {
    return Collections.emptyList();
  }

  String path = WebServerPathToFileManager.getInstance(project).getPath(file);
  if (path == null) {
    return Collections.emptyList();
  }

  int effectiveBuiltInServerPort = BuiltInServerOptions.getInstance().getEffectiveBuiltInServerPort();
  Url url = Urls.newHttpUrl(currentAuthority == null ? "localhost:" + effectiveBuiltInServerPort : currentAuthority, '/' + project.getName() + '/' + path);
  int defaultPort = BuiltInServerManager.getInstance().getPort();
  if (currentAuthority != null || defaultPort == effectiveBuiltInServerPort) {
    return Collections.singletonList(url);
  }
  return Arrays.asList(url, Urls.newHttpUrl("localhost:" + defaultPort, '/' + project.getName() + '/' + path));
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:20,
代码来源:BuiltInWebBrowserUrlProvider.java

示例2: compareAuthority

点赞 3

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
public static boolean compareAuthority(@Nullable String currentAuthority) {
  if (StringUtil.isEmpty(currentAuthority)) {
    return false;
  }

  int portIndex = currentAuthority.indexOf(':');
  if (portIndex < 0) {
    return false;
  }

  String host = currentAuthority.substring(0, portIndex);
  if (!BuiltInWebServerKt.isOwnHostName(host)) {
    return false;
  }

  int port = StringUtil.parseInt(currentAuthority.substring(portIndex + 1), -1);
  return port == BuiltInServerOptions.getInstance().getEffectiveBuiltInServerPort() ||
         port == BuiltInServerManager.getInstance().getPort();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:20,
代码来源:BuiltInWebBrowserUrlProvider.java

示例3: get

点赞 3

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
@Override
public Image get(Object key) {
  if (myManager == null || key == null) return null;
  PsiElement element = getElement();
  if (element == null) return null;
  URL url = (URL)key;
  Image inMemory = myManager.getElementImage(element, url.toExternalForm());
  if (inMemory != null) {
    return inMemory;
  }

  Url parsedUrl = Urls.parseEncoded(url.toExternalForm());
  BuiltInServerManager builtInServerManager = BuiltInServerManager.getInstance();
  if (parsedUrl != null && builtInServerManager.isOnBuiltInWebServer(parsedUrl)) {
    try {
      url = new URL(builtInServerManager.addAuthToken(parsedUrl).toExternalForm());
    }
    catch (MalformedURLException e) {
      LOG.warn(e);
    }
  }
  return Toolkit.getDefaultToolkit().createImage(url);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:24,
代码来源:DocumentationComponent.java

示例4: getOAuthRedirectUrl

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
@NotNull
public static String getOAuthRedirectUrl() {
  int port = BuiltInServerManager.getInstance().getPort();

  // according to https://confluence.jetbrains.com/display/IDEADEV/Remote+communication
  int defaultPort = BuiltInServerOptions.getInstance().builtInServerPort;
  if (port >= defaultPort && port < (defaultPort + 20)) {
    return "http://localhost:" + port + "/api/" + EduStepicNames.OAUTH_SERVICE_NAME;
  }

  return EduStepicNames.EXTERNAL_REDIRECT_URL;
}
 

开发者ID:medvector,
项目名称:educational-plugin,
代码行数:13,
代码来源:EduStepicConnector.java

示例5: getEffectiveBuiltInServerPort

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
public int getEffectiveBuiltInServerPort() {
  MyCustomPortServerManager portServerManager = CustomPortServerManager.EP_NAME.findExtension(MyCustomPortServerManager.class);
  if (!portServerManager.isBound()) {
    return BuiltInServerManager.getInstance().getPort();
  }
  return builtInServerPort;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:8,
代码来源:BuiltInServerOptions.java

示例6: getEditorCommand

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
/**
 * Get editor command
 *
 * @return the editor command
 */
@NotNull
public synchronized String getEditorCommand() {
  synchronized (myScriptLock) {
    if (myEditorCommand == null) {
      ScriptGenerator generator = new ScriptGenerator(GIT_REBASE_EDITOR_PREFIX, GitRebaseEditorMain.class);
      generator.addInternal(Integer.toString(BuiltInServerManager.getInstance().getPort()));
      generator.addClasses(XmlRpcClientLite.class, DecoderException.class);
      myEditorCommand = generator.commandLine();
    }
    return myEditorCommand;
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:18,
代码来源:GitRebaseEditorService.java

示例7: setUp

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
@Override protected void setUp() throws Exception {
  super.setUp();
  GitTestUtil.createRepository(myProject, myProjectPath, false);
  myRebaser = new GitRebaser(myProject, ServiceManager.getService(Git.class), new EmptyProgressIndicator());
  myFirstCommit = makeCommit();
  BuiltInServerManager.getInstance().waitForStart();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:8,
代码来源:GitRebaserReorderCommitsTest.java

示例8: doExecute

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
    final RunProfile runProfileRaw = env.getRunProfile();
    if (runProfileRaw instanceof UI5RunConfiguration) {

        FileDocumentManager.getInstance().saveAllDocuments();
        final UI5RunConfiguration runProfile = (UI5RunConfiguration) runProfileRaw;
        final UI5RunnerParameters params = runProfile.getRunnerParameters();

        BuiltInServerManager serverManager = BuiltInServerManager.getInstance().waitForStart();
        BrowserLauncher.getInstance().browse("http://localhost:" + serverManager.getPort()
                + getClientApplicationPath(env.getProject()), params.getWebBrowser(), env.getProject());
    }
    return super.doExecute(state, env);
}
 

开发者ID:asebak,
项目名称:ui5-intellij-plugin,
代码行数:16,
代码来源:UI5Runner.java

示例9: bind

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
public boolean bind(int port) {
  if (port == BuiltInServerManager.getInstance().getPort()) {
    return true;
  }

  try {
    openChannels.add(bootstrap.bind(user.isAvailableExternally() ? new InetSocketAddress(port) : new InetSocketAddress(NetUtils.getLoopbackAddress(), port)));
    return true;
  }
  catch (Exception e) {
    NettyUtil.log(e, BuiltInServer.LOG);
    user.cannotBind(e, port);
    return false;
  }
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:16,
代码来源:SubServer.java

示例10: process

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
@Override
protected boolean process(ChannelHandlerContext context, HttpRequest request, QueryStringDecoder urlDecoder) throws IOException, ImageWriteException {
  HttpRequestHandler connectedHandler = (HttpRequestHandler)context.getAttachment();
  if (connectedHandler != null) {
    if (connectedHandler.isSupported(request) && connectedHandler.process(urlDecoder, request, context)) {
      return true;
    }
    // prev cached connectedHandler is not suitable for this request, so, let's find it again
    context.setAttachment(null);
  }

  if (urlDecoder.getPath().equals("/favicon.ico")) {
    Icon icon = IconLoader.findIcon(ApplicationInfoEx.getInstanceEx().getSmallIconUrl());
    if (icon != null) {
      BufferedImage image = UIUtil.createImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
      icon.paintIcon(null, image.getGraphics(), 0, 0);
      byte[] icoBytes = Sanselan.writeImageToBytes(image, ImageFormat.IMAGE_FORMAT_ICO, null);
      Responses.send(icoBytes, FileResponses.createResponse(urlDecoder.getPath()), request, context);
      return true;
    }
  }

  for (HttpRequestHandler handler : BuiltInServerManager.EP_NAME.getExtensions()) {
    try {
      if (handler.isSupported(request) && handler.process(urlDecoder, request, context)) {
        if (context.getAttachment() == null) {
          context.setAttachment(handler);
        }
        return true;
      }
    }
    catch (Throwable e) {
      BuiltInServer.LOG.error(e);
    }
  }
  return false;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:38,
代码来源:DelegatingHttpRequestHandler.java

示例11: getXmlRcpPort

点赞 2

import org.jetbrains.ide.BuiltInServerManager; //导入依赖的package包/类
/**
 * @return the port number for XML RCP
 */
public int getXmlRcpPort() {
  return BuiltInServerManager.getInstance().waitForStart().getPort();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:7,
代码来源:GitXmlRpcHandlerService.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)