@Override public void run(ITextSelection selection) { if (!checkEnabled(selection)) return; IRegion region= new Region(selection.getOffset(), selection.getLength()); PropertyKeyHyperlinkDetector detector= new PropertyKeyHyperlinkDetector(); detector.setContext(fEditor); IHyperlink[]hyperlinks= detector.detectHyperlinks(fEditor.internalGetSourceViewer(), region, false); if (hyperlinks != null && hyperlinks.length == 1) hyperlinks[0].open(); } }
private boolean checkEnabled(ITextSelection selection) { if (selection == null || selection.isEmpty()) return false; return PropertyKeyHyperlinkDetector.checkEnabled(fEditor, selection.getOffset()); }
static boolean checkEnabled(ITextEditor textEditor, int offset) { if (offset < 0) return false; IEditorInput editorInput= textEditor.getEditorInput(); return editorInput instanceof IFileEditorInput || (editorInput instanceof IStorageEditorInput && isEclipseNLSAvailable((IStorageEditorInput) editorInput)); }
@Override public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { ITextEditor textEditor= getAdapter(ITextEditor.class); if (region == null || textEditor == null) return null; if (!checkEnabled(textEditor, offset)) return null; int delta= key.indexOf(realKey); String unicodeKey= getUnicodeString(realKey); return null; } catch (IllegalArgumentException ex) { showErrorInStatusLine(ex.getLocalizedMessage(), textEditor); return null;
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { ITextEditor textEditor= (ITextEditor)getAdapter(ITextEditor.class); if (region == null || textEditor == null || canShowMultipleHyperlinks) return null; if (!checkEnabled(textEditor, offset)) return null; int delta= key.indexOf(realKey); String unicodeKey= getUnicodeString(realKey);
@Override public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { ITextEditor textEditor= getAdapter(ITextEditor.class); if (region == null || textEditor == null) return null; if (!checkEnabled(textEditor, offset)) return null; int delta= key.indexOf(realKey); String unicodeKey= getUnicodeString(realKey); return null; } catch (IllegalArgumentException ex) { showErrorInStatusLine(ex.getLocalizedMessage(), textEditor); return null;
public void run(ITextSelection selection) { if (!checkEnabled(selection)) return; IRegion region= new Region(selection.getOffset(), selection.getLength()); PropertyKeyHyperlinkDetector detector= new PropertyKeyHyperlinkDetector(); detector.setContext(fEditor); IHyperlink[]hyperlinks= detector.detectHyperlinks(fEditor.internalGetSourceViewer(), region, false); if (hyperlinks != null && hyperlinks.length == 1) hyperlinks[0].open(); } }
private boolean checkEnabled(ITextSelection selection) { if (selection == null || selection.isEmpty()) return false; return PropertyKeyHyperlinkDetector.checkEnabled(fEditor, selection.getOffset()); }
static boolean checkEnabled(ITextEditor textEditor, int offset) { if (offset < 0) return false; IEditorInput editorInput= textEditor.getEditorInput(); return editorInput instanceof IFileEditorInput || (editorInput instanceof IStorageEditorInput && isEclipseNLSAvailable((IStorageEditorInput) editorInput)); }
@Override public void run(ITextSelection selection) { if (!checkEnabled(selection)) return; IRegion region= new Region(selection.getOffset(), selection.getLength()); PropertyKeyHyperlinkDetector detector= new PropertyKeyHyperlinkDetector(); detector.setContext(fEditor); IHyperlink[]hyperlinks= detector.detectHyperlinks(fEditor.internalGetSourceViewer(), region, false); if (hyperlinks != null && hyperlinks.length == 1) hyperlinks[0].open(); } }
/** * Creates a new <code>OpenAction</code>. * * @param editor the Properties file editor which provides the context information for this action */ public OpenAction(PropertiesFileEditor editor) { super(editor.getEditorSite()); fEditor= editor; setText(PropertiesFileEditorMessages.OpenAction_label); setToolTipText(PropertiesFileEditorMessages.OpenAction_tooltip); setEnabled(PropertyKeyHyperlinkDetector.checkEnabled(fEditor, 0)); }
if (document != null) { FindReplaceDocumentAdapter finder= new FindReplaceDocumentAdapter(document); PropertyKeyHyperlinkDetector detector= new PropertyKeyHyperlinkDetector(); detector.setContext(editor); String key= PropertyFileDocumentModel.unwindEscapeChars(fKeyName); int offset= document.getLength() - 1; else { IHyperlink[] hyperlinks= detector.detectHyperlinks(null, region, false); if (hyperlinks != null) { for (int i= 0; i < hyperlinks.length; i++) {
/** * Creates a new <code>OpenAction</code>. * * @param editor the Properties file editor which provides the context information for this action */ public OpenAction(PropertiesFileEditor editor) { super(editor.getEditorSite()); fEditor= editor; setText(PropertiesFileEditorMessages.OpenAction_label); setToolTipText(PropertiesFileEditorMessages.OpenAction_tooltip); setEnabled(PropertyKeyHyperlinkDetector.checkEnabled(fEditor, 0)); }
if (document != null) { FindReplaceDocumentAdapter finder= new FindReplaceDocumentAdapter(document); PropertyKeyHyperlinkDetector detector= new PropertyKeyHyperlinkDetector(); detector.setContext(editor); String key= PropertyFileDocumentModel.escape(keyName, false); int offset= document.getLength() - 1; else { IHyperlink[] hyperlinks= detector.detectHyperlinks(null, region, false); if (hyperlinks != null) { for (int i= 0; i < hyperlinks.length; i++) {
if (document != null) { FindReplaceDocumentAdapter finder= new FindReplaceDocumentAdapter(document); PropertyKeyHyperlinkDetector detector= new PropertyKeyHyperlinkDetector(); detector.setContext(editor); String key= PropertyFileDocumentModel.escape(keyName, false); int offset= document.getLength() - 1; else { IHyperlink[] hyperlinks= detector.detectHyperlinks(null, region, false); if (hyperlinks != null) { for (int i= 0; i < hyperlinks.length; i++) {