Java 类org.eclipse.jface.text.IEditingSupport 实例源码

项目:ftc    文件:TweakedLinkedModeUI.java   
public void documentAboutToBeChanged(DocumentEvent event) {

            // default behavior: any document change outside a linked position
            // causes us to exit
            int end = event.getOffset() + event.getLength();
            for (int offset = event.getOffset(); offset <= end; offset++) {
                if (!fModel.anyPositionContains(offset)) {
                    ITextViewer viewer = fCurrentTarget.getViewer();
                    if (fFramePosition != null && viewer instanceof IEditingSupportRegistry) {
                        IEditingSupport[] helpers = ((IEditingSupportRegistry) viewer).getRegisteredSupports();
                        for (int i = 0; i < helpers.length; i++) {
                            if (helpers[i].isOriginator(null,
                                    new Region(fFramePosition.getOffset(), fFramePosition.getLength())))
                                return;
                        }
                    }

                    leave(ILinkedModeListener.EXTERNAL_MODIFICATION);
                    return;
                }
            }

            // Make sure that any document change is done inside a compound
            // change
            beginCompoundChangeIfNeeded();

        }
项目:Eclipse-Postfix-Code-Completion    文件:OrganizeImportsAction.java   
private IEditingSupport createViewerHelper() {
    return new IEditingSupport() {
        public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
            return true; // assume true, since we only register while we are active
        }
        public boolean ownsFocusShell() {
            return fIsQueryShowing;
        }

    };
}
项目:Eclipse-Postfix-Code-Completion    文件:OrganizeImportsAction.java   
private void registerHelper(IEditingSupport helper, JavaEditor editor) {
    ISourceViewer viewer= editor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.register(helper);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:OrganizeImportsAction.java   
private void deregisterHelper(IEditingSupport helper, JavaEditor editor) {
    ISourceViewer viewer= editor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.unregister(helper);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:AddImportOnSelectionAction.java   
private IEditingSupport createViewerHelper(final ITextSelection selection, final SelectTypeQuery query) {
    return new IEditingSupport() {

        public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
            return subjectRegion.getOffset() <= selection.getOffset() + selection.getLength() &&  selection.getOffset() <= subjectRegion.getOffset() + subjectRegion.getLength();
        }

        public boolean ownsFocusShell() {
            return query.isShowing();
        }

    };
}
项目:Eclipse-Postfix-Code-Completion    文件:AddImportOnSelectionAction.java   
private void registerHelper(IEditingSupport helper) {
    ISourceViewer viewer= fEditor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.register(helper);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:AddImportOnSelectionAction.java   
private void deregisterHelper(IEditingSupport helper) {
    ISourceViewer viewer= fEditor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.unregister(helper);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:OrganizeImportsAction.java   
private IEditingSupport createViewerHelper() {
    return new IEditingSupport() {
        public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
            return true; // assume true, since we only register while we are active
        }
        public boolean ownsFocusShell() {
            return fIsQueryShowing;
        }

    };
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:OrganizeImportsAction.java   
private void registerHelper(IEditingSupport helper, JavaEditor editor) {
    ISourceViewer viewer= editor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.register(helper);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:OrganizeImportsAction.java   
private void deregisterHelper(IEditingSupport helper, JavaEditor editor) {
    ISourceViewer viewer= editor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.unregister(helper);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AddImportOnSelectionAction.java   
private IEditingSupport createViewerHelper(final ITextSelection selection, final SelectTypeQuery query) {
    return new IEditingSupport() {

        public boolean isOriginator(DocumentEvent event, IRegion subjectRegion) {
            return subjectRegion.getOffset() <= selection.getOffset() + selection.getLength() &&  selection.getOffset() <= subjectRegion.getOffset() + subjectRegion.getLength();
        }

        public boolean ownsFocusShell() {
            return query.isShowing();
        }

    };
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AddImportOnSelectionAction.java   
private void registerHelper(IEditingSupport helper) {
    ISourceViewer viewer= fEditor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.register(helper);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AddImportOnSelectionAction.java   
private void deregisterHelper(IEditingSupport helper) {
    ISourceViewer viewer= fEditor.getViewer();
    if (viewer instanceof IEditingSupportRegistry) {
        IEditingSupportRegistry registry= (IEditingSupportRegistry) viewer;
        registry.unregister(helper);
    }
}
项目:ftc    文件:TweakedLinkedModeUI.java   
public void shellDeactivated(ShellEvent e) {
    // TODO re-enable after debugging
    // if (true) return;

    // from LinkedPositionUI:

    // don't deactivate on focus lost, since the proposal popups may
    // take focus
    // plus: it doesn't hurt if you can check with another window
    // without losing linked mode
    // since there is no intrusive popup sticking out.

    // need to check first what happens on reentering based on an open
    // action
    // Seems to be no problem

    // Better:
    // Check with content assistant and only leave if its not the
    // proposal shell that took the
    // focus away.

    StyledText text;
    final ITextViewer viewer;
    Display display;

    if (fCurrentTarget == null || (text = fCurrentTarget.fWidget) == null || text.isDisposed()
            || (display = text.getDisplay()) == null || display.isDisposed()
            || (viewer = fCurrentTarget.getViewer()) == null) {
        leave(ILinkedModeListener.EXIT_ALL);
    } else {
        // Post in UI thread since the assistant popup will only get the
        // focus after we lose it.
        display.asyncExec(new Runnable() {
            public void run() {
                if (fIsActive && viewer instanceof IEditingSupportRegistry) {
                    IEditingSupport[] helpers = ((IEditingSupportRegistry) viewer).getRegisteredSupports();
                    for (int i = 0; i < helpers.length; i++) {
                        if (helpers[i].ownsFocusShell())
                            return;
                    }
                }

                // else
                leave(ILinkedModeListener.EXIT_ALL);

            }
        });
    }
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
public void register(IEditingSupport helper) {
    viewer.register(helper);
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
public void unregister(IEditingSupport helper) {
    viewer.unregister(helper);
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
public IEditingSupport[] getRegisteredSupports() {
    return viewer.getRegisteredSupports();
}