org.openide.text.Line.getLookup()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(114)

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

Line.getLookup介绍

[英]Provides access to the context passed into the line constructor. For example lines produced by DataEditorSupport provide DataObject as the content of the lookup. One can use:

dataObjectOrNull = (DataObject)line.getLookup ().lookup (DataObject.class);

to get the access.
[中]提供对传递到行构造函数中的上下文的访问。例如,DataEditorSupport生成的行提供DataObject作为查找的内容。您可以使用:

dataObjectOrNull = (DataObject)line.getLookup ().lookup (DataObject.class);

获得访问权限。

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects

@Override
  public Lookup getLookup() {
    return lineNew.getLookup();
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui

@Override
  public Lookup getLookup() {
    return lineNew.getLookup();
  }
});

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders

/** Support method that extracts a DataObject from a Line. If the 
 * line is created by a DataEditorSupport then associated DataObject
 * can be accessed by this method.
 *
 * @param l line object 
 * @return data object or null
 *
 * @since 4.3
 */
public static DataObject findDataObject (Line l) {
  if (l == null) throw new NullPointerException();
  return (DataObject)l.getLookup ().lookup (DataObject.class);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static DataObject dataObjectForLine(Line l) {
// 6502318
if (l == null)
  return null;
org.openide.util.Lookup lineLookup = l.getLookup();
DataObject dao = lineLookup.lookup(DataObject.class);
if (dao == null)
  return null;
if (dao instanceof DataShadow)
  dao = ((DataShadow) dao).getOriginal ();
return dao;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

@Override
public URL getURL() {
  if (line instanceof FutureLine) {
    return ((FutureLine) line).getURL();
  }
  return line.getLookup().lookup(FileObject.class).toURL();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

if (lb != null) {
  Line line = JSUtils.getLine(lb);
  FileObject fo = line.getLookup().lookup(FileObject.class);
  if (fo != null) {
    File file = FileUtil.toFile(fo);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

@Override
public void setLineNumber(int lineNumber) {
  lineNumber--; // Line works with 0-based lines.
  if (line.getLineNumber() == lineNumber) {
    return ;
  }
  LineCookie lineCookie = line.getLookup().lookup(LineCookie.class);
  Line.Set lineSet = lineCookie.getLineSet();
  List<? extends Line> lines = lineSet.getLines();
  if (lines.size() > 0) {
    int lastLineNumber = lines.get(lines.size() - 1).getLineNumber();
    if (lineNumber > lastLineNumber) {
      lineNumber = lastLineNumber;
    }
  }
  Line cline;
  try {
    cline = lineSet.getCurrent(lineNumber);
  } catch (IndexOutOfBoundsException ioobex) {
    cline = lineSet.getCurrent(0);
  }
  setLine(cline);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

private static Pair<Line.Part, FileObject> getContext(EditorContextProvider ecp) {
  Line.Part lp = ecp.getContext();
  if (lp == null) {
    Line line = EditorContextDispatcher.getDefault().getMostRecentLine();
    if (line != null) {
      lp = line.createPart(0, 0);
    }
  }
  FileObject file;
  if (lp != null) {
    file = lp.getLine().getLookup().lookup(FileObject.class);
  } else {
    file = null;
  }
  return Pair.of(lp, file);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

@Override
public FileObject getFileObject() {
  if (line instanceof FutureLine) {
    URL url = getURL();
    FileObject fo = URLMapper.findFileObject(url);
    if (fo != null) {
      try {
        DataObject dobj = DataObject.find(fo);
        LineCookie lineCookie = dobj.getLookup().lookup(LineCookie.class);
        if (lineCookie == null) {
          return null;
        }
        Line l = lineCookie.getLineSet().getCurrent(getLineNumber() - 1);
        setLine(l);
      } catch (DataObjectNotFoundException ex) {
      }
    }
    return fo;
  } else {
    return line.getLookup().lookup(FileObject.class);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

EditorCookie ec = curentLine.getLookup().lookup(EditorCookie.class);
if (ec != null) {
  ec.prepareDocument().waitFinished();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-debug-ui

return;
final FileObject fo = line.getLookup().lookup(FileObject.class);
if (isFunctionPtr[0]) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projectsui

final FileObject fo = line.getLookup().lookup(FileObject.class);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

private void evalExpression(final Part lp) {
  try {
    Line line = lp.getLine();
    Lookup lineLookup = line.getLookup();
    DataObject dobj = lineLookup.lookup(DataObject.class);

相关文章