@Override String getText(ISelection selection) { ITextSelection ts= (ITextSelection)selection; return ts.getText(); }
@Override String getText(ISelection selection) { ITextSelection ts= (ITextSelection)selection; return ts.getText(); }
@Override public String getText() { return textSelection.getText(); }
private boolean isNonTrivialSelection(ITextSelection selection) { if (selection.getLength() < 30) { String text= selection.getText(); if (text != null) { for (int i= 0; i < text.length(); i++) { if (!Character.isJavaIdentifierPart(text.charAt(i))) { return true; } } } return false; } return true; }
private boolean isNonTrivialSelection(ITextSelection selection) { if (selection.getLength() < 30) { String text= selection.getText(); if (text != null) { for (int i= 0; i < text.length(); i++) { if (!Character.isJavaIdentifierPart(text.charAt(i))) { return true; } } } return false; } return true; }
private boolean isNonTrivialSelection(ITextSelection selection) { if (selection.getLength() < 30) { String text= selection.getText(); if (text != null) { for (int i= 0; i < text.length(); i++) { if (!Character.isJavaIdentifierPart(text.charAt(i))) { return true; } } } return false; } return true; }
private SearchPatternData trySimpleTextSelection(ITextSelection selection) { String selectedText= selection.getText(); if (selectedText != null && selectedText.length() > 0) { int i= 0; while (i < selectedText.length() && !IndentManipulation.isLineDelimiterChar(selectedText.charAt(i))) { i++; } if (i > 0) { return new SearchPatternData(TYPE, REFERENCES, 0, fIsCaseSensitive, selectedText.substring(0, i), null, JavaSearchScopeFactory.ALL); } } return null; }
private SearchPatternData trySimpleTextSelection(ITextSelection selection) { String selectedText= selection.getText(); if (selectedText != null && selectedText.length() > 0) { int i= 0; while (i < selectedText.length() && !IndentManipulation.isLineDelimiterChar(selectedText.charAt(i))) { i++; } if (i > 0) { return new SearchPatternData(TYPE, REFERENCES, 0, fIsCaseSensitive, selectedText.substring(0, i), null, JavaSearchScopeFactory.ALL); } } return null; }
private SearchPatternData trySimpleTextSelection(ITextSelection selection) { String selectedText= selection.getText(); if (selectedText != null && selectedText.length() > 0) { int i= 0; while (i < selectedText.length() && !IndentManipulation.isLineDelimiterChar(selectedText.charAt(i))) { i++; } if (i > 0) { return new SearchPatternData(TYPE, REFERENCES, fIsCaseSensitive, selectedText.substring(0, i), null, JavaSearchScopeFactory.ALL); } } return null; }
/** * Returns the selected text. */ public String getSelectedText() { String sql = null; if (getSelectionProvider() == null) { return null; } //get the selection ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection(); if (!selection.isEmpty() && selection.getText() != null && !selection.getText().equals("")) //$NON-NLS-1$ { sql = selection.getText(); } return sql; }
public void run(IAction action) { ScriptConsoleManager manager = ScriptConsoleManager.getInstance(); IScriptConsole console = manager.getActiveScriptConsole(RutaConsole.CONSOLE_TYPE); if (console == null) { return; } if (selection instanceof ITextSelection) { String text = ((ITextSelection) selection).getText(); console.insertText(text); } }
@Override public void dragStart(DragSourceEvent event) { fTextDragAndDropToken= null; try { fSelection= st.getSelection(); event.doit= isLocationSelected(new Point(event.x, event.y)); ISelection selection= selectionProvider.getSelection(); if (selection instanceof ITextSelection) fSelectedText= ((ITextSelection)selection).getText(); else // fallback to widget fSelectedText= st.getSelectionText(); } catch (IllegalArgumentException ex) { event.doit= false; } }
@Override public void dragStart(DragSourceEvent event) { fTextDragAndDropToken= null; try { fSelection= st.getSelection(); event.doit= isLocationSelected(new Point(event.x, event.y)); ISelection selection= selectionProvider.getSelection(); if (selection instanceof ITextSelection) fSelectedText= ((ITextSelection)selection).getText(); else // fallback to widget fSelectedText= st.getSelectionText(); } catch (IllegalArgumentException ex) { event.doit= false; } }
final protected String extractSearchTextFromSelection(ISelection sel) { if (sel instanceof ITextSelection) { String text= ((ITextSelection) sel).getText(); if (text != null) { return trimSearchString(text); } } else if (sel instanceof IStructuredSelection) { Object firstElement= ((IStructuredSelection) sel).getFirstElement(); if (firstElement instanceof IAdaptable) { IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter) ((IAdaptable) firstElement).getAdapter(IWorkbenchAdapter.class); if (wbAdapter != null) { return wbAdapter.getLabel(firstElement); } } } return null; }
private boolean initializePatternControl() { ISelection selection = getSelection(); if (selection instanceof ITextSelection && !selection.isEmpty()) { String text = ((ITextSelection) selection).getText(); if (text != null) { if (isRegExButton.getSelection()) patternCombo.setText(FindReplaceDocumentAdapter .escapeForRegExPattern(text)); else patternCombo.setText(insertEscapeChars(text)); return true; } } return false; }
final protected String extractSearchTextFromSelection(ISelection sel) { if (sel instanceof ITextSelection) { String text= ((ITextSelection) sel).getText(); if (text != null) { return trimSearchString(text); } } else if (sel instanceof IStructuredSelection) { Object firstElement= ((IStructuredSelection) sel).getFirstElement(); if (firstElement instanceof IAdaptable) { IWorkbenchAdapter wbAdapter= ((IAdaptable) firstElement).getAdapter(IWorkbenchAdapter.class); if (wbAdapter != null) { return wbAdapter.getLabel(firstElement); } } } return null; }
private void copyToClipboard(ITextSelection selection, int repeatCount) { try{ fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT) throw e; if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message)) copyToClipboard(selection, repeatCount + 1); } } }
@Override public int open() { if (getInitialPattern() == null) { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { ISelection selection = window.getSelectionService().getSelection(); if (selection instanceof ITextSelection) { String text = ((ITextSelection) selection).getText(); if (text != null) { text = text.trim(); if (text.length() > 0) { setInitialPattern(text); } } } } } return super.open(); }
private void copyToClipboard(ITextSelection selection, int repeatCount) { try{ fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT) throw e; if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message)) copyToClipboard(selection, repeatCount + 1); } } }
private void copyToClipboard(ITextSelection selection, int repeatCount) { try{ fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT) throw e; if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message)) copyToClipboard(selection, repeatCount + 1); } } }