本文整理汇总了Java中org.netbeans.lib.editor.hyperlink.spi.HyperlinkType类的典型用法代码示例。如果您正苦于以下问题:Java HyperlinkType类的具体用法?Java HyperlinkType怎么用?Java HyperlinkType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HyperlinkType类属于org.netbeans.lib.editor.hyperlink.spi包,在下文中一共展示了HyperlinkType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getTooltipText
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public String getTooltipText(Document doc, int offset, HyperlinkType type) {
TokenHierarchy th = TokenHierarchy.get(doc);
TokenSequence<JavaTokenId> ts = SourceUtils.getJavaTokenSequence(th, offset);
if (ts == null) {
return null;
}
ts.move(offset);
if (!ts.moveNext()) {
return null;
}
Token<JavaTokenId> t = ts.token();
FileObject fo = getFileObject(doc);
String name = t.text().toString();
name = name.substring(name.startsWith("\"") ? 1 : 0, name.endsWith("\"") ? name.length() - 1 : name.length());
String query = findNq(fo, name);
if (query != null) {
return query;
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NamedQueryHyperlinkProvider.java
示例2: mouseMoved
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
public void mouseMoved(MouseEvent e) {
HyperlinkType type = getHyperlinkType(e);
if (type != null) {
int position = component.viewToModel(e.getPoint());
if (position < 0) {
unHyperlink(true);
return ;
}
performHyperlinking(position, type);
} else {
unHyperlink(true);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:HyperlinkOperation.java
示例3: performHyperlinking
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
private void performHyperlinking(int position, HyperlinkType type) {
final BaseDocument doc = (BaseDocument) component.getDocument();
doc.readLock();
try {
HyperlinkProviderExt provider = findProvider(position, type);
if (provider != null) {
int[] offsets = provider.getHyperlinkSpan(doc, position, type);
if (offsets != null) {
makeHyperlink(type, provider, offsets[0], offsets[1], position);
}
} else {
unHyperlink(true);
}
} finally {
doc.readUnlock();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:HyperlinkOperation.java
示例4: keyPressed
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
public void keyPressed(KeyEvent e) {
HyperlinkType type = getHyperlinkType(e);
Point mousePos = null;
try {
mousePos = component.getMousePosition();
} catch (NullPointerException npe) {
// #199407 - on systems without mouse this can happen
// instead of returning null
}
if (type != null && mousePos != null) {
int position = component.viewToModel(mousePos);
if (position < 0) {
unHyperlink(true);
return;
}
performHyperlinking(position, type);
} else {
unHyperlink(true);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:HyperlinkOperation.java
示例5: mouseClicked
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
public void mouseClicked(MouseEvent e) {
if(e.isConsumed()) return;
boolean activate = false;
HyperlinkType type = getHyperlinkType(e);
if ( type != null ) {
activate = !e.isPopupTrigger() && e.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(e);
} else if ( Utilities.isWindows() && e.getClickCount() == 1 && SwingUtilities.isMiddleMouseButton(e) ) {
activate = true;
type = HyperlinkType.GO_TO_DECLARATION;
}
if ( activate ) {
int position = component.viewToModel(e.getPoint());
if (position < 0) {
return ;
}
performAction(position, type);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:HyperlinkOperation.java
示例6: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public void performClickAction(final Document doc, final int offset, final HyperlinkType type) {
final String issueId = getIssueId(doc, offset, type);
if(issueId == null) {
return;
}
class IssueDisplayer implements Runnable {
@Override
public void run() {
DataObject dobj = (DataObject) doc.getProperty(Document.StreamDescriptionProperty);
FileObject fileObject = null;
if (dobj != null) {
fileObject = dobj.getPrimaryFile();
}
if(fileObject == null) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "EditorHyperlinkProviderImpl - no file found for given document");
return;
}
Util.openIssue(fileObject, issueId);
}
}
RequestProcessor.getDefault().post(new IssueDisplayer());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:EditorHyperlinkProviderImpl.java
示例7: getHyperlinkSpan
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
public int[] getHyperlinkSpan(Document doc, int offset, HyperlinkType type) {
if (!(doc instanceof BaseDocument)) {
return null;
}
try {
BaseDocument bdoc = (BaseDocument) doc;
int start = Utilities.getRowStart(bdoc, offset);
int end = Utilities.getRowEnd(bdoc, offset);
for (int[] span : Parser.recognizeURLs(DocumentUtilities.getText(doc, start, end - start))) {
if (span[0] + start <= offset && offset <= span[1] + start) {
return new int[] {
span[0] + start,
span[1] + start
};
}
}
} catch (BadLocationException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:HyperlinkImpl.java
示例8: getTooltipText
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public String getTooltipText(Document doc, int offset, HyperlinkType type) {
int linesToShow = 20;
String textToShow = null;
try {
String methodNameWitClassName = doc.getText(startOffset, endOffset - startOffset);
String className = RoutesLanguageHelper.getOnlyClassNameFromCompleteMethodSignature(methodNameWitClassName);
File fileWithPathToOpen = MiscUtil.getPathFile(doc, className);
if (fileWithPathToOpen.exists()) {
FileObject foToOpen = FileUtil.toFileObject(fileWithPathToOpen);
String fileContent = foToOpen.asText();
String methodName = RoutesLanguageHelper.getOnlyMethodNameFromCompleteMethodSignature(methodNameWitClassName);
int lineNumber = MiscUtil.getLineNumber(fileContent, methodName);
textToShow = MiscUtil.getLinesFromFileContent(fileContent, lineNumber, linesToShow)
+ MiscUtil.LINE_SEPARATOR + "Showing max " + (linesToShow + 1) + " lines ...";
}
} catch (BadLocationException | IOException ex) {
ExceptionManager.logException(ex);
}
//FUTURE: allow returned tool tip formatted to highlight java and scala syntax
// return "<html><b>"+textToShow+"<b></html>";
return textToShow;
}
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:26,代码来源:RoutesHyperlinkProvider.java
示例9: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public void performClickAction(Document doc, int offset, HyperlinkType type) {
if (!(doc instanceof StyledDocument)) {
return;
}
switch (type) {
case GO_TO_DECLARATION:
GoToSupport.goTo((StyledDocument)doc, offset, false);
break;
case ALT_HYPERLINK:
JTextComponent focused = EditorRegistry.focusedComponent();
if (focused != null && focused.getDocument() == doc) {
focused.setCaretPosition(offset);
GoToImplementation.goToImplementation(focused);
}
break;
}
}
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:21,代码来源:GrammarHyperlinkProvider.java
示例10: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public void performClickAction(Document doc, int offset, HyperlinkType type) {
JTextComponent component = getComponent(doc);
if (component == null) {
return;
}
switch (type) {
case GO_TO_DECLARATION:
GoToSupport.goTo(component, offset, false);
break;
// case ALT_HYPERLINK:
// JTextComponent focused = EditorRegistry.focusedComponent();
// if (focused != null && focused.getDocument() == doc) {
// focused.setCaretPosition(offset);
// GoToImplementation.goToImplementation(focused);
// }
// break;
}
}
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:22,代码来源:GoHyperlinkProvider.java
示例11: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public void performClickAction(final Document doc, final int offset, HyperlinkType type) {
final AtomicBoolean cancel = new AtomicBoolean();
ProgressUtils.runOffEventDispatchThread(new Runnable() {
@Override
public void run() {
goToNQ(doc, offset);
}
}, NbBundle.getMessage(NamedQueryHyperlinkProvider.class, "LBL_GoToNamedQuery"), cancel, false);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NamedQueryHyperlinkProvider.java
示例12: getMouseCursor
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
private static synchronized Cursor getMouseCursor(HyperlinkType type) {
switch (type) {
case GO_TO_DECLARATION:
case ALT_HYPERLINK:
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
default:
throw new UnsupportedOperationException();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:HyperlinkOperation.java
示例13: getHyperlinkType
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
private HyperlinkType getHyperlinkType(InputEvent e) {
int modifiers = e.getModifiers() | e.getModifiersEx();
if ((modifiers & altActionKeyMask) == altActionKeyMask && ((modifiers & InputEvent.SHIFT_MASK) == 0)) { // Ctrl/Cmd + Shift + Click is Add-Caret
return HyperlinkType.ALT_HYPERLINK;
} else if ((modifiers & actionKeyMask) == actionKeyMask && ((modifiers & InputEvent.SHIFT_MASK) == 0)) { // Ctrl/Cmd + Shift + Click is Add-Caret)
return HyperlinkType.GO_TO_DECLARATION;
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:HyperlinkOperation.java
示例14: performAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
private void performAction(int position, HyperlinkType type) {
HyperlinkProviderExt provider = findProvider(position, type);
if (provider != null) {
unHyperlink(true);
//make sure the position is correct and the JumpList works:
component.getCaret().setDot(position);
JumpList.checkAddEntry(component, position);
provider.performClickAction(component.getDocument(), position, type);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HyperlinkOperation.java
示例15: makeHyperlink
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
private synchronized void makeHyperlink(HyperlinkType type, HyperlinkProviderExt provider, final int start, final int end, final int offset) {
boolean makeCursorSnapshot = true;
if (hyperlinkUp) {
unHyperlink(false);
makeCursorSnapshot = false;
}
OffsetsBag prepare = new OffsetsBag(component.getDocument());
FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class);
AttributeSet hyperlinksHighlight = fcs.getFontColors("hyperlinks"); //NOI18N
prepare.addHighlight(start, end, AttributesUtilities.createComposite(
hyperlinksHighlight != null ? hyperlinksHighlight : defaultHyperlinksHighlight,
AttributesUtilities.createImmutable(EditorStyleConstants.Tooltip, new TooltipResolver(provider, offset, type))));
getBag(currentDocument).setHighlights(prepare);
hyperlinkUp = true;
if (makeCursorSnapshot) {
if (component.isCursorSet()) {
oldComponentsMouseCursor = component.getCursor();
} else {
oldComponentsMouseCursor = null;
}
component.setCursor(getMouseCursor(type));
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:HyperlinkOperation.java
示例16: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的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
示例17: getTooltipText
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public String getTooltipText(Document doc, int offset, HyperlinkType type) {
Line ln = getLine(doc, offset);
if (ln != null) {
return ln.getText();
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ApisupportHyperlinkProvider.java
示例18: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
public void performClickAction(Document doc, int offset, HyperlinkType type) {
EditCookie ec = getEditorCookie(doc, offset);
if (ec != null) {
ec.edit();
} else {
Toolkit.getDefaultToolkit().beep();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ManifestHyperlinkProvider.java
示例19: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
@Override
public void performClickAction(Document doc, int offset, HyperlinkType type) {
EditCookie ec = getEditorCookie(doc, offset);
if (ec != null) {
ec.edit();
} else {
Toolkit.getDefaultToolkit().beep();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:FXMLHyperlinkProvider.java
示例20: performClickAction
import org.netbeans.lib.editor.hyperlink.spi.HyperlinkType; //导入依赖的package包/类
public void performClickAction(Document doc, int offset, HyperlinkType type) {
switch (type) {
case GO_TO_DECLARATION:
GoToSupport.goTo(doc, offset, false);
break;
case ALT_HYPERLINK:
JTextComponent focused = EditorRegistry.focusedComponent();
if (focused != null && focused.getDocument() == doc) {
focused.setCaretPosition(offset);
GoToImplementation.goToImplementation(focused);
}
break;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:JavaHyperlinkProvider.java
注:本文中的org.netbeans.lib.editor.hyperlink.spi.HyperlinkType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论