gpt4 book ai didi

org.netbeans.modules.web.common.api.WebUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 20:53:05 27 4
gpt4 key购买 nike

本文整理了Java中org.netbeans.modules.web.common.api.WebUtils类的一些代码示例,展示了WebUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebUtils类的具体详情如下:
包路径:org.netbeans.modules.web.common.api.WebUtils
类名称:WebUtils

WebUtils介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

@Override
  public void run(ResultIterator resultIterator) throws Exception {
    ResultIterator htmlRi = WebUtils.getResultIterator(resultIterator, "text/html"); //NOI18N
    if (htmlRi != null) {
      Parser.Result pr = htmlRi.getParserResult();
      if (pr instanceof HtmlParsingResult) {
        result.set((HtmlParsingResult) pr);
      }
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

@Override
public FileObject fromServer(int projectContext, URL serverURL) {
  String query = serverURL.getQuery();
  // #219339 - strip down query and/or fragment:
  serverURL = WebUtils.stringToUrl(WebUtils.urlToString(serverURL, true));
  if (serverURL == null) {
    return null;
  }
  init();
  if (projectRootURL == null || webDocumentRoot == null) {
    return null;
  }
  WebBrowser browser = getWebBrowser();
  if (browser != null) {
    serverURL = browser.fromBrowserURL(getWebProject(), serverURL);
  }
  String u = WebUtils.urlToString(serverURL);
  if (u.startsWith(projectRootURL)) {
    String name = u.substring(projectRootURL.length());
    if (name.isEmpty()) {
      // name is empty - try to map server URL to one of the welcome files:
      return getExistingWelcomeFile();
    } else {
      // use servlet mappings to map server URL to a project file:
      return convertServerURLToProjectFile(name, query);
    }
  }
  return null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-inspect

/**
 * Start listening on CSS. Propagate changes to given webkit.
 * @param webKit 
 */
synchronized void start(WebKitDebugging webKit, Project project) {
  assert webKit !=null : "webKit allready assigned"; // NOI18N
  this.webKit = webKit;
  for (StyleSheetHeader header : webKit.getCSS().getAllStyleSheets()) {
    try {
      //need to convert file:///
      URL url = new URL(header.getSourceURL());
      sheetsMap.put(url.toString(), header);
      if (project != null) {
        FileObject fob = ServerURLMapping.fromServer(project, url);
        if (fob != null) {
          fobToSheetMap.put(fob, header);
        }
      }
      
      //TODO: hack to workaround #221791
      if (WebUtils.getLocalhostInetAddress().equals(InetAddress.getByName(url.getHost()))) {
        sheetsMap.put(new URL(url.toExternalForm().replace(url.getHost(), "localhost")).toString(), header); // NOI18N
      }
      
      
    } catch (IOException ex) {
      //ignore unknown sheets
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

u = WebUtils.stringToUrl(root + relPath);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

@Override
public void showURL(URL applicationRootURL, URL urlToOpenInBrowser, FileObject context) {
  projectRootURL = applicationRootURL == null ? null : WebUtils.urlToString(applicationRootURL);
  if (projectRootURL != null && !projectRootURL.contains(".") && !projectRootURL.endsWith("/")) {
    projectRootURL += "/";
  }
  if (project.getProjectDirectory().equals(context) && webProject != null) {
    // this is scenario of EAR project executing its Web Project; use
    // Web Project as context instead of EAR here:
    context = webProject.getProjectDirectory();
  }
  // let browser update URL if necessary:
  WebBrowser browser = getWebBrowser();
  if (browser != null) {
    urlToOpenInBrowser = browser.toBrowserURL(getWebProject(), context, urlToOpenInBrowser);
    browserUsageLogger.log(projectType, browser.getId(), browser.getBrowserFamily().name());
  } else {
    WebBrowser wb = BrowserUISupport.getDefaultBrowserChoice(true);
    browserUsageLogger.log(projectType, wb.getId(), wb.getBrowserFamily().name());
  }
  BrowserSupport bs = getBrowserSupport();
  if (bs != null) {
    bs.load(urlToOpenInBrowser, context);
  } else {
    HtmlBrowser.URLDisplayer.getDefault().showURL(urlToOpenInBrowser);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-css-prep

@Override
public String getRhsHtml(HtmlFormatter formatter) {
  if(origin == null) {
    return super.getRhsHtml(formatter);
  } else {
    formatter.appendHtml("<font color=");
    formatter.appendHtml(WebUtils.toHexCode(LFCustoms.shiftColor(ORIGIN_COLOR)));
    formatter.appendHtml(">");
    formatter.appendText(origin);
    formatter.appendHtml("</font>"); //NOI18N
    return formatter.getText();
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-inspect

label.setIcon(WebUtils.createColorIcon(colorCode));

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-html-angular

case VALUE:
   if (interestedAttr != null) {
    String value = WebUtils.unquotedValue(tokenText);
    switch (interestedAttr) {
      case controller:

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-css-prep

int quotesDiff = WebUtils.isValueQuoted(ts.token().text().toString()) ? 1 : 0;
OffsetRange range = new OffsetRange(ts.offset() + quotesDiff, ts.offset() + ts.token().length() - quotesDiff);
CharSequence mixinName;

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-css-prep

@Override
public String getLhsHtml(HtmlFormatter formatter) {
  switch (handle.getType()) {
    case VARIABLE_GLOBAL_DECLARATION:
    case MIXIN_DECLARATION:
      formatter.appendHtml("<font color=");
      formatter.appendHtml(WebUtils.toHexCode(LFCustoms.shiftColor(COLOR)));
      formatter.appendHtml("><b>"); //NOI18N
      break;
  }
  
  formatter.appendText(getName());
  
  switch (handle.getType()) {
    case MIXIN_DECLARATION:
    case VARIABLE_GLOBAL_DECLARATION:
      formatter.appendHtml("</b></font>"); //NOI18N);
      break;
  }
  
  return formatter.getText();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

@Override
public FileObject fromServer(int projectContext, URL serverURL) {
  // #219339 - strip down query and/or fragment:
  serverURL = WebUtils.stringToUrl(WebUtils.urlToString(serverURL, true));
  if (serverURL == null) {
    return null;
  }
  initProjectUrl();
  if (projectRootUrl == null) {
    return null;
  }
  FileObject webRoot = project.getWebRootDirectory();
  if (webRoot == null) {
    return null;
  }
  WebBrowser browser = getWebBrowser();
  if (browser != null) {
    serverURL = browser.fromBrowserURL(project, serverURL);
  }
  String url = CommandUtils.urlToString(serverURL, true);
  if (url.startsWith(projectRootUrl)) {
    return webRoot.getFileObject(url.substring(projectRootUrl.length()));
  }
  return null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-css-prep

@Override
  public void run(ResultIterator resultIterator) throws Exception {
    ResultIterator cssRI = WebUtils.getResultIterator(resultIterator, "text/css");
    if (cssRI != null) {
      CssParserResult result = (CssParserResult) cssRI.getParserResult();
      if (result != null) {
        model_ref.set(CPModel.getModel(result));
      }
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

@Override
public FileObject fromServer(int projectContext, URL serverURL) {
  serverURL = WebUtils.stringToUrl(WebUtils.urlToString(serverURL, true));
  if (serverURL == null) {
    return null;
      return null;
    String u = WebUtils.urlToString(serverURL);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-inspect

@Override
  public void run(ResultIterator resultIterator) throws Exception {
    ResultIterator ri = WebUtils.getResultIterator(resultIterator, "text/html"); // NOI18N
    if (ri != null) {
      Parser.Result result = ri.getParserResult();
      delegate.setContext(file);
      org.netbeans.modules.html.editor.lib.api.elements.Node sourceNode =
          sourceElementHandle.resolve(result);
      if (sourceNode != null) {
        delegate.setHtmlSourceElementHandle((OpenTag)sourceNode, result.getSnapshot(), file);
        RP.post(new Runnable() {
          @Override
          public void run() {
            delegate.actionPerformed(null);
          }
        });
      }
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

private void browseFile(BrowserSupport bs, FileObject fo, String fragment) {
    URL url;
    if (FileUtil.isParentOf(project.getSiteRootFolder(), fo)) {
      url = ServerURLMapping.toServer(project, fo);
      if (fragment.length() > 0) {
        url = WebUtils.stringToUrl(WebUtils.urlToString(url)+fragment);
      }
      bs.load(url, fo);
    } else {
      url = fo.toURL();
      WebBrowser wb = project.getProjectWebBrowser();
      WebBrowserFeatures features = new WebBrowserFeatures(false, false, false, false, false, false);
      wb.createNewBrowserPane(features).showURL(url);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-inspect

@Override
public void run(ResultIterator resultIterator) throws Exception {
  ResultIterator htmlResultIterator = WebUtils.getResultIterator(resultIterator, "text/html"); // NOI18N
  final int offsetToShow;
  if (htmlResultIterator == null) {
    offsetToShow = 0;
  } else {
    HtmlParsingResult result = (HtmlParsingResult)htmlResultIterator.getParserResult();
    Node nodeToShow = Utilities.findNode(result, node);
    Snapshot snapshot = htmlResultIterator.getSnapshot();
    int snapshotOffset = nodeToShow.from();
    offsetToShow = snapshot.getOriginalOffset(snapshotOffset);
  }
  EventQueue.invokeLater(new Runnable() {
    @Override
    public void run() {
      CSSUtils.openAtOffset(fob, offsetToShow);
    }
  });
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-css-prep

@Override
public void run(ResultIterator ri) throws ParseException {
  ResultIterator cssri = WebUtils.getResultIterator(ri, "text/css");
  if (cssri != null) {
    CssParserResult result = (CssParserResult) cssri.getParserResult();
    if (result.getParseTree() != null) {
      //the parser result seems to be quite ok,
      //in case of serious parse issue the parse root is null
      RefactoringElementContext context = new RefactoringElementContext(result, caretOffset, selectionStart, selectionEnd);
      ui = context.isRefactoringAllowed() ? createRefactoringUI(context) : null;
    }
  }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com