@Override public void install(ITextViewer textViewer) { Assert.isNotNull(textViewer); fViewer= textViewer; fLayoutManager= new LayoutManager(); fInternalListener= new InternalListener(); AdditionalInfoController2 controller= null; if (fInformationControlCreator != null) controller= new AdditionalInfoController2(fInformationControlCreator, OpenStrategy.getPostSelectionDelay()); fContextInfoPopup= new ContextInformationPopup2(this, fViewer); fProposalPopup= new CompletionProposalPopup2(this, fViewer, controller); manageAutoActivation(fIsAutoActivated); }
protected void add(Object popup, Shell shell, int type, int offset) { Assert.isNotNull(popup); Assert.isTrue(shell != null && !shell.isDisposed()); checkType(type); if (fShells[type] != shell) { if (fShells[type] != null) fShells[type].removeListener(SWT.Dispose, this); shell.addListener(SWT.Dispose, this); fShells[type]= shell; } fPopups[type]= popup; if (type == LAYOUT_CONTEXT_SELECTOR || type == LAYOUT_CONTEXT_INFO_POPUP) fContextType= type; layout(type, offset); adjustListeners(type); }
shell.setLocation(getStackedLocation(shell, parent)); } else if (fContextType != LAYOUT_CONTEXT_SELECTOR || !Helper2.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR])) { shell.setLocation(getBelowLocation(shell, offset)); } else { switch (fProposalPopupOrientation) { shell.setLocation(getBelowLocation(shell, offset)); break; shell.setLocation(getBelowLocation(shell, offset)); break; shell.setLocation(getStackedLocation(shell, parent)); break;
shell.setLocation(getStackedLocation(shell, parent)); } else if (fContextType != LAYOUT_CONTEXT_SELECTOR || !Helper2.okToUse(fShells[LAYOUT_CONTEXT_SELECTOR])) { shell.setLocation(getBelowLocation(shell, offset)); } else { switch (fProposalPopupOrientation) { shell.setLocation(getBelowLocation(shell, offset)); break; shell.setLocation(getBelowLocation(shell, offset)); break; shell.setLocation(getStackedLocation(shell, parent)); break;
source.removeListener(SWT.Dispose, this); int type= getShellType(source); checkType(type); fShells[type]= null; if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { if (fProposalPopupOrientation == PROPOSAL_STACKED) layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset()); if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { if (fContextInfoPopupOrientation == CONTEXT_INFO_BELOW) layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset());
source.removeListener(SWT.Dispose, this); int type= getShellType(source); checkType(type); fShells[type]= null; if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { if (fProposalPopupOrientation == PROPOSAL_STACKED) layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset()); if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { if (fContextInfoPopupOrientation == CONTEXT_INFO_BELOW) layout(LAYOUT_PROPOSAL_SELECTOR, getSelectionOffset());
protected void layoutContextSelector(int offset) { // Always place the context selector beneath the cursor line. Shell shell= fShells[LAYOUT_CONTEXT_SELECTOR]; shell.setLocation(getBelowLocation(shell, offset)); if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { switch (fProposalPopupOrientation) { case PROPOSAL_REMOVE: // Remove the proposal selector. fShells[LAYOUT_PROPOSAL_SELECTOR].dispose(); break; case PROPOSAL_OVERLAY: // The proposal selector has been overlaid by the tip selector. break; case PROPOSAL_STACKED: { // Stack the proposal selector beneath the tip selector. shell= fShells[LAYOUT_PROPOSAL_SELECTOR]; Shell parent= fShells[LAYOUT_CONTEXT_SELECTOR]; shell.setLocation(getStackedLocation(shell, parent)); break; } } } }
protected void layoutContextSelector(int offset) { // Always place the context selector beneath the cursor line. Shell shell= fShells[LAYOUT_CONTEXT_SELECTOR]; shell.setLocation(getBelowLocation(shell, offset)); if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { switch (fProposalPopupOrientation) { case PROPOSAL_REMOVE: // Remove the proposal selector. fShells[LAYOUT_PROPOSAL_SELECTOR].dispose(); break; case PROPOSAL_OVERLAY: // The proposal selector has been overlaid by the tip selector. break; case PROPOSAL_STACKED: { // Stack the proposal selector beneath the tip selector. shell= fShells[LAYOUT_PROPOSAL_SELECTOR]; Shell parent= fShells[LAYOUT_CONTEXT_SELECTOR]; shell.setLocation(getStackedLocation(shell, parent)); break; } } } }
protected void layoutContextInfoPopup(int offset) { switch (fContextInfoPopupOrientation) { case CONTEXT_INFO_ABOVE: { // Place the popup above the cursor line. Shell shell= fShells[LAYOUT_CONTEXT_INFO_POPUP]; shell.setLocation(getAboveLocation(shell, offset)); break; } case CONTEXT_INFO_BELOW: { // Place the popup beneath the cursor line. Shell parent= fShells[LAYOUT_CONTEXT_INFO_POPUP]; parent.setLocation(getBelowLocation(parent, offset)); if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { // Stack the proposal selector beneath the context info popup. Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR]; shell.setLocation(getStackedLocation(shell, parent)); } break; } } }
protected void layoutContextInfoPopup(int offset) { switch (fContextInfoPopupOrientation) { case CONTEXT_INFO_ABOVE: { // Place the popup above the cursor line. Shell shell= fShells[LAYOUT_CONTEXT_INFO_POPUP]; shell.setLocation(getAboveLocation(shell, offset)); break; } case CONTEXT_INFO_BELOW: { // Place the popup beneath the cursor line. Shell parent= fShells[LAYOUT_CONTEXT_INFO_POPUP]; parent.setLocation(getBelowLocation(parent, offset)); if (Helper2.okToUse(fShells[LAYOUT_PROPOSAL_SELECTOR])) { // Stack the proposal selector beneath the context info popup. Shell shell= fShells[LAYOUT_PROPOSAL_SELECTOR]; shell.setLocation(getStackedLocation(shell, parent)); } break; } } }
protected void add(Object popup, Shell shell, int type, int offset) { Assert.isNotNull(popup); Assert.isTrue(shell != null && !shell.isDisposed()); checkType(type); if (fShells[type] != shell) { if (fShells[type] != null) fShells[type].removeListener(SWT.Dispose, this); shell.addListener(SWT.Dispose, this); fShells[type]= shell; } fPopups[type]= popup; if (type == LAYOUT_CONTEXT_SELECTOR || type == LAYOUT_CONTEXT_INFO_POPUP) fContextType= type; layout(type, offset); adjustListeners(type); }
/** * Adds the given shell of the specified type to the layout. * Valid types are defined by <code>LayoutManager</code>. * * @param popup a content assist popup * @param shell the shell of the content-assist popup * @param type the type of popup * @param visibleOffset the offset at which to layout the popup relative to the offset of the viewer's visible region * @since 2.0 */ void addToLayout(Object popup, Shell shell, int type, int visibleOffset) { fLayoutManager.add(popup, shell, type, visibleOffset); }
protected void layout(int type, int offset) { switch (type) { case LAYOUT_PROPOSAL_SELECTOR: layoutProposalSelector(offset); break; case LAYOUT_CONTEXT_SELECTOR: layoutContextSelector(offset); break; case LAYOUT_CONTEXT_INFO_POPUP: layoutContextInfoPopup(offset); break; } }
/** * Adds the given shell of the specified type to the layout. * Valid types are defined by <code>LayoutManager</code>. * * @param popup a content assist popup * @param shell the shell of the content-assist popup * @param type the type of popup * @param visibleOffset the offset at which to layout the popup relative to the offset of the viewer's visible region * @since 2.0 */ void addToLayout(Object popup, Shell shell, int type, int visibleOffset) { fLayoutManager.add(popup, shell, type, visibleOffset); }
@Override public void install(ITextViewer textViewer) { Assert.isNotNull(textViewer); fViewer= textViewer; fLayoutManager= new LayoutManager(); fInternalListener= new InternalListener(); AdditionalInfoController2 controller= null; if (fInformationControlCreator != null) controller= new AdditionalInfoController2(fInformationControlCreator, OpenStrategy.getPostSelectionDelay()); fContextInfoPopup= new ContextInformationPopup2(this, fViewer); fProposalPopup= new CompletionProposalPopup2(this, fViewer, controller); manageAutoActivation(fIsAutoActivated); }
protected void layout(int type, int offset) { switch (type) { case LAYOUT_PROPOSAL_SELECTOR: layoutProposalSelector(offset); break; case LAYOUT_CONTEXT_SELECTOR: layoutContextSelector(offset); break; case LAYOUT_CONTEXT_INFO_POPUP: layoutContextInfoPopup(offset); break; } }
/** * Layouts the registered popup of the given type relative to the * given offset. The offset is relative to the offset of the viewer's visible region. * Valid types are defined by <code>LayoutManager</code>. * * @param type the type of popup to layout * @param visibleOffset the offset at which to layout relative to the offset of the viewer's visible region * @since 2.0 */ void layout(int type, int visibleOffset) { fLayoutManager.layout(type, visibleOffset); }
/** * Layouts the registered popup of the given type relative to the * given offset. The offset is relative to the offset of the viewer's visible region. * Valid types are defined by <code>LayoutManager</code>. * * @param type the type of popup to layout * @param visibleOffset the offset at which to layout relative to the offset of the viewer's visible region * @since 2.0 */ void layout(int type, int visibleOffset) { fLayoutManager.layout(type, visibleOffset); }