当前位置: 首页>>代码示例>>Java>>正文


Java Line.show方法代码示例

本文整理汇总了Java中org.openide.text.Line.show方法的典型用法代码示例。如果您正苦于以下问题:Java Line.show方法的具体用法?Java Line.show怎么用?Java Line.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.text.Line的用法示例。


在下文中一共展示了Line.show方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openFileAtOffset

import org.openide.text.Line; //导入方法依赖的package包/类
private static boolean openFileAtOffset(DataObject dataObject, int offset) throws IOException {
    EditorCookie ec = dataObject.getCookie(EditorCookie.class);
    LineCookie lc = dataObject.getCookie(LineCookie.class);
    if (ec != null && lc != null) {
        StyledDocument doc = ec.openDocument();
        if (doc != null) {
            int lineNumber = NbDocument.findLineNumber(doc, offset);
            if (lineNumber != -1) {
                Line line = lc.getLineSet().getCurrent(lineNumber);
                if (line != null) {
                    int lineOffset = NbDocument.findLineOffset(doc, lineNumber);
                    int column = offset - lineOffset;
                    line.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:SpringXMLConfigEditorUtils.java

示例2: openErrorDescription

import org.openide.text.Line; //导入方法依赖的package包/类
@Messages("ERR_CannotOpen=Cannot open target file")
static void openErrorDescription(AnalyzerFactory analyzer, ErrorDescription ed) throws IndexOutOfBoundsException {
    try {
        DataObject od = DataObject.find(ed.getFile());
        LineCookie lc = od.getLookup().lookup(LineCookie.class);

        if (lc != null) {
            Line line = lc.getLineSet().getCurrent(ed.getRange().getBegin().getLine());

            line.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
            analyzer.warningOpened(ed);
        }
    } catch (IOException ex) {
        Exceptions.printStackTrace(Exceptions.attachLocalizedMessage(Exceptions.attachSeverity(ex, Level.WARNING), Bundle.ERR_CannotOpen()));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:Nodes.java

示例3: showSourceLine

import org.openide.text.Line; //导入方法依赖的package包/类
static Line showSourceLine (String url, int lineNumber, Object timeStamp) {
    Line l = LineTranslations.getTranslations().getLine (url, lineNumber, timeStamp); // false = use original ln
    if (l == null) {
        ErrorManager.getDefault().log(ErrorManager.WARNING,
                "Show Source: Have no line for URL = "+url+", line number = "+lineNumber);
        return null;
    }
    Properties p = Properties.getDefault().getProperties("debugger.options.JPDA");
    boolean reuseEditorTabs = p.getBoolean("ReuseEditorTabs", true);
    if ("true".equalsIgnoreCase(fronting)) {
        if (reuseEditorTabs) {
            l.show (ShowOpenType.REUSE, ShowVisibilityType.FOCUS);
        } else {
            l.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
        }
        l.show (ShowOpenType.OPEN, ShowVisibilityType.FRONT); //FIX 47825
    } else {
        if (reuseEditorTabs) {
            l.show (ShowOpenType.REUSE, ShowVisibilityType.FOCUS);
        } else {
            l.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
        }
    }
    return l;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:EditorContextImpl.java

示例4: showSource

import org.openide.text.Line; //导入方法依赖的package包/类
/**
 * Shows source with given url on given line number.
 *
 * @param url a url of source to be shown
 * @param lineNumber a number of line to be shown
 * @param timeStamp a time stamp to be used
 */
public boolean showSource (String url, int lineNumber, int column, int length, Object timeStamp) {
    Line l = LineTranslations.getTranslations().getLine (url, lineNumber, timeStamp); // false = use original ln
    if (l == null) {
        ErrorManager.getDefault().log(ErrorManager.WARNING,
                "Show Source: Have no line for URL = "+url+", line number = "+lineNumber);
        return false;
    }
    if ("true".equalsIgnoreCase(fronting)) {
        l.show (ShowOpenType.OPEN, ShowVisibilityType.FRONT, column); //FIX 47825
    } else {
        l.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
    }
    addPositionToJumpList(url, l, column);
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:EditorContextImpl.java

示例5: openEditor

import org.openide.text.Line; //导入方法依赖的package包/类
public static void openEditor(EditorCookie ec, int lineIndex) {
    Line.Set lineSet = ec.getLineSet();
    if (lineSet != null) {
        try {
            Line line = lineSet.getCurrent(lineIndex);
            if (line != null) {
                line.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
            }
        } catch (IndexOutOfBoundsException ex) {
            // attempt at least to open the editor
            ec.open();
            // expected, bookmark contains an invalid line
            StatusDisplayer.getDefault().setStatusText(
                    NbBundle.getMessage(BookmarkUtils.class, "MSG_InvalidLineNumnber", lineIndex));
        }
        JEditorPane[] panes = ec.getOpenedPanes();
        if (panes.length > 0) {
            panes[0].requestFocusInWindow();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:BookmarkUtils.java

示例6: performClickAction

import org.openide.text.Line; //导入方法依赖的package包/类
@Override
public void performClickAction(Document doc, int offset, HyperlinkType type) {
    Line ln = getLine(doc, offset);
    if (ln != null) {
        ln.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
    } else {
        Toolkit.getDefaultToolkit().beep();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ApisupportHyperlinkProvider.java

示例7: show

import org.openide.text.Line; //导入方法依赖的package包/类
void show () {
    DataObject dataObject = NbEditorUtilities.getDataObject (document);
    LineCookie lineCookie = dataObject.getCookie (LineCookie.class);
    Line.Set lineSet = lineCookie.getLineSet ();
    Line line = lineSet.getCurrent (NbDocument.findLineNumber (document, item.getOffset ()));
    int column = NbDocument.findLineColumn (document, item.getOffset ());
    line.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:LanguagesNavigatorModel.java

示例8: openAt

import org.openide.text.Line; //导入方法依赖的package包/类
private boolean openAt( LineCookie lineCookie, int lineNo ) {
    Line.Set lines = lineCookie.getLineSet();
    try {
        Line line = lines.getCurrent( lineNo );
        if( null == line )
            line = lines.getCurrent( 0 );
        if( null != line ) {
            line.show( ShowOpenType.OPEN , ShowVisibilityType.FOCUS);
            return true;
        }
    } catch( IndexOutOfBoundsException e ) {
        //probably the document has been modified but not saved yet
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:OpenTaskAction.java

示例9: open

import org.openide.text.Line; //导入方法依赖的package包/类
public void open() {
    try {
        PositionRef pos = ed.getRange().getBegin();
        int line = pos.getLine();
        int column = pos.getColumn();
        Line l = pos.getCloneableEditorSupport().getLineSet().getCurrent(line);

        l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Nodes.java

示例10: edit

import org.openide.text.Line; //导入方法依赖的package包/类
private static void edit(@NonNull final DataObject dobj, final int lineNo) {
    // if linenumber is given then try to open file at this line
    // code taken from org.netbeans.modules.java.stackanalyzer.StackLineAnalyser.Link.show()
    LineCookie lineCookie = dobj.getLookup().lookup(LineCookie.class);
    if (lineCookie == null) {
        //Workaround of non functional org.openide.util.Lookup class hierarchy cache.
        lineCookie = dobj.getLookup().lookup(EditorCookie.class);
    }
    if (lineCookie != null && lineNo != -1) {
        try {
            final Line l = lineCookie.getLineSet().getCurrent(lineNo - 1);
            if (l != null) {
                // open file at the given line
                l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS, -1);
                return;
            }
        } catch (IndexOutOfBoundsException oob) {
            LOG.log(Level.FINE, "Line no more exists.", oob);   //NOI18N
        }
    }
    Editable editable = dobj.getLookup().lookup(Editable.class);
    if (editable == null) {
        //Workaround of non functional org.openide.util.Lookup class hierarchy cache.
        editable = dobj.getLookup().lookup(EditCookie.class);
    }
    if (editable != null) {
        editable.edit();
        return;
    }
    open(dobj);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:FileDescription.java

示例11: doShow

import org.openide.text.Line; //导入方法依赖的package包/类
private static void doShow(final Line l, final int column) {
    if (SwingUtilities.isEventDispatchThread()) {
        l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
    } else {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:UiUtils.java

示例12: open

import org.openide.text.Line; //导入方法依赖的package包/类
@Override
    public void open(final FileObject file, final int lineno) {
        // FIXME this should not be needed
        if (!SwingUtilities.isEventDispatchThread()) {
            SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        open(file, lineno);
                    }
                });

            return; // not exactly accurate, but....
        }

        try {
            DataObject od = DataObject.find(file);
            EditorCookie ec = od.getCookie(EditorCookie.class);
            LineCookie lc = od.getCookie(LineCookie.class);

            if ((ec != null) && (lc != null)) {
                Document doc = ec.openDocument();

                if (doc != null) {
                    int line = lineno;

                    if (line < 1) {
                        line = 1;
                    }

                    // XXX .size() call is super-slow for large files, see issue
                    // #126531. So we fallback to catching IOOBE
//                    int nOfLines = lines.getLines().size();
//                    if (line > nOfLines) {
//                        line = nOfLines;
//                    }
                    try {
                        Line.Set lines = lc.getLineSet();
                        Line l = lines.getCurrent(line - 1);
                        if (l != null) {
                            l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS);
                            return;
                        }
                    } catch (IndexOutOfBoundsException ioobe) {
                        // OK, since .size() cannot be used, see above
                    }
                }
            }

            OpenCookie oc = od.getCookie(OpenCookie.class);

            if (oc != null) {
                oc.open();
                return;
            }
        } catch (IOException e) {
            LOGGER.log(Level.INFO, null, e);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:58,代码来源:NbFileOpenHandler.java

示例13: doEDT

import org.openide.text.Line; //导入方法依赖的package包/类
private void doEDT() {
    if (lc != null) {
        Line l = lc.getLineSet().getOriginal(lineNumber - 1);
        l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:OpenInEditorAction.java

示例14: goToSource

import org.openide.text.Line; //导入方法依赖的package包/类
private static void goToSource(JSLineBreakpoint breakpoint ) {
    Line line = JSUtils.getLine(breakpoint);
    if (line != null) {
        line.show(Line.ShowOpenType.REUSE, Line.ShowVisibilityType.FOCUS);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:BreakpointNodeActionProvider.java


注:本文中的org.openide.text.Line.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。