@Override protected boolean isValidSelection(ITextSelection selection) { return selection != null && !selection.isEmpty(); } }
@Override protected boolean isValidSelection(ITextSelection selection) { return selection != null && !selection.isEmpty(); }
protected boolean isValidSelection(ITextSelection selection) { return selection != null && !selection.isEmpty(); }
private boolean checkEnabled(ITextSelection selection) { if (selection == null || selection.isEmpty()) return false; // XXX: Must be changed to IStorageEditorInput once support for JARs is available (see class Javadoc for details) return fEditor.getEditorInput() instanceof IFileEditorInput; }
@Override protected boolean isValidSelection(ITextSelection selection) { return selection != null && !selection.isEmpty() && selection.getLength() > 0; }
@Override public boolean isEmpty() { return structuredSelection.isEmpty() && textSelection.isEmpty(); }
@Override protected boolean isValidSelection(ITextSelection selection) { return selection != null && !selection.isEmpty() && selection.getLength() > 0; }
protected boolean isValidSelection(ITextSelection selection) { return selection != null && !selection.isEmpty() && selection.getLength() > 0; }
private boolean checkEnabled(ITextSelection selection) { if (selection == null || selection.isEmpty()) return false; return PropertyKeyHyperlinkDetector.checkEnabled(fEditor, selection.getOffset()); }
private boolean checkEnabled(ITextSelection selection) { if (selection == null || selection.isEmpty()) return false; return PropertyKeyHyperlinkDetector.checkEnabled(fEditor, selection.getOffset()); }
/** * 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) { if (fEditor instanceof ITextEditor) { ITextEditor textEditor = (ITextEditor) fEditor; IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); if (document != null) { // get current text selection ITextSelection textSelection = getCurrentSelection(); if (textSelection.isEmpty()) { return; } processAction(document, textSelection); } } }
protected IDocumentRange getRangeElement(ITextSelection selection) { if (selection.isEmpty()) return null; IBuildModel model = (IBuildModel) getInputContext().getModel(); return findBuildNode(model.getBuild().getBuildEntries(), selection.getOffset()); }
if (selection.isEmpty()) return false;
if (selection.isEmpty()) return false;
public void update() { super.update(); if (isEnabled()) if (fIsTabAction) setEnabled(canModifyEditor() && isSmartMode() && isValidSelection()); else setEnabled(canModifyEditor() && !getSelection().isEmpty()); }
@Override public void update() { super.update(); if (isEnabled()) if (fIsTabAction) setEnabled(canModifyEditor() && isSmartMode() && isValidSelection()); else setEnabled(canModifyEditor() && !getSelection().isEmpty()); }
@Override public void update() { super.update(); if (isEnabled()) if (fIsTabAction) setEnabled(canModifyEditor() && isSmartMode() && isValidSelection()); else setEnabled(canModifyEditor() && !getSelection().isEmpty()); }
/** * Returns the attributes the new marker will be initialized with. * <p> * Subclasses may extend or replace this method.</p> * * @return the attributes the new marker will be initialized with */ protected Map<String, Object> getInitialAttributes() { Map<String, Object> attributes= new HashMap<>(11); ITextSelection selection= (ITextSelection) getTextEditor().getSelectionProvider().getSelection(); if (!selection.isEmpty()) { int start= selection.getOffset(); int length= selection.getLength(); if (length < 0) { length= -length; start -= length; } MarkerUtilities.setCharStart(attributes, start); MarkerUtilities.setCharEnd(attributes, start + length); // marker line numbers are 1-based int line= selection.getStartLine(); MarkerUtilities.setLineNumber(attributes, line == -1 ? -1 : line + 1); IDocument document= getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput()); MarkerUtilities.setMessage(attributes, getLabelProposal(document, start, length)); } return attributes; }
/** * Returns the attributes the new marker will be initialized with. * <p> * Subclasses may extend or replace this method.</p> * * @return the attributes the new marker will be initialized with */ protected Map getInitialAttributes() { Map attributes= new HashMap(11); ITextSelection selection= (ITextSelection) getTextEditor().getSelectionProvider().getSelection(); if (!selection.isEmpty()) { int start= selection.getOffset(); int length= selection.getLength(); if (length < 0) { length= -length; start -= length; } MarkerUtilities.setCharStart(attributes, start); MarkerUtilities.setCharEnd(attributes, start + length); // marker line numbers are 1-based int line= selection.getStartLine(); MarkerUtilities.setLineNumber(attributes, line == -1 ? -1 : line + 1); IDocument document= getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput()); MarkerUtilities.setMessage(attributes, getLabelProposal(document, start, length)); } return attributes; }