@Override public void widgetSelected(SelectionEvent e) { handleTableSelectionChanged(); }
/** * Creates a new additional information controller. * * @param creator the information control creator to be used by this controller * @param delay time in milliseconds after which additional info should be displayed */ AdditionalInfoController2(IInformationControlCreator creator, int delay) { super(creator); fDelay= delay; setAnchor(ANCHOR_RIGHT); setFallbackAnchors(new Anchor[] {ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM }); }
@Override protected void computeInformation() { if (fProposalTable == null || fProposalTable.isDisposed()) return; TableItem[] selection= fProposalTable.getSelection(); if (selection != null && selection.length > 0) { TableItem item= selection[0]; // compute information String information= null; Object d= item.getData(); if (d instanceof ICompletionProposal) { ICompletionProposal p= (ICompletionProposal) d; information= p.getAdditionalProposalInfo(); } if (d instanceof ICompletionProposalExtension3) setCustomInformationControlCreator(((ICompletionProposalExtension3) d).getInformationControlCreator()); else setCustomInformationControlCreator(null); // compute subject area setMargins(4, -1); Rectangle area= fProposalTable.getBounds(); area.x= 0; // subject area is the whole subject control area.y= 0; // set information & subject area setInformation(information, area); } }
fAdditionalInfoController.install(fProposalTable); fAdditionalInfoController.handleTableSelectionChanged();
@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); }
fAdditionalInfoController.setSizeConstraints(50, 10, true, false);
fProposalTable.getDisplay().asyncExec(() -> { if (!fIsReset) showInformation(); });
@Override protected void computeInformation() { if (fProposalTable == null || fProposalTable.isDisposed()) return; TableItem[] selection= fProposalTable.getSelection(); if (selection != null && selection.length > 0) { TableItem item= selection[0]; // compute information String information= null; Object d= item.getData(); if (d instanceof ICompletionProposal) { ICompletionProposal p= (ICompletionProposal) d; information= p.getAdditionalProposalInfo(); } if (d instanceof ICompletionProposalExtension3) setCustomInformationControlCreator(((ICompletionProposalExtension3) d).getInformationControlCreator()); else setCustomInformationControlCreator(null); // compute subject area setMargins(4, -1); Rectangle area= fProposalTable.getBounds(); area.x= 0; // subject area is the whole subject control area.y= 0; // set information & subject area setInformation(information, area); } }
fAdditionalInfoController.install(fProposalTable); fAdditionalInfoController.handleTableSelectionChanged();
@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); }
fAdditionalInfoController.setSizeConstraints(50, 10, true, false);
/** * Creates a new additional information controller. * * @param creator the information control creator to be used by this controller * @param delay time in milliseconds after which additional info should be displayed */ AdditionalInfoController2(IInformationControlCreator creator, int delay) { super(creator); fDelay= delay; setAnchor(ANCHOR_RIGHT); setFallbackAnchors(new Anchor[] {ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM }); }
@Override public void widgetSelected(SelectionEvent e) { handleTableSelectionChanged(); }
/** * Selects the entry with the given index in the proposal selector and feeds * the selection to the additional info controller. * * @param index the index in the list * @param smartToggle <code>true</code> if the smart toogle key has been pressed * @since 2.1 */ private void selectProposal(int index, boolean smartToggle) { ICompletionProposal oldProposal= getSelectedProposal(); if (oldProposal instanceof ICompletionProposalExtension2) ((ICompletionProposalExtension2) oldProposal).unselected(fViewer); ICompletionProposal proposal= fFilteredProposals[index]; if (proposal instanceof ICompletionProposalExtension2) ((ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle); fLastProposal= proposal; fProposalTable.setSelection(index); fProposalTable.showSelection(); if (fAdditionalInfoController != null) fAdditionalInfoController.handleTableSelectionChanged(); }
/** * Selects the entry with the given index in the proposal selector and feeds * the selection to the additional info controller. * * @param index the index in the list * @param smartToggle <code>true</code> if the smart toogle key has been pressed * @since 2.1 */ private void selectProposal(int index, boolean smartToggle) { ICompletionProposal oldProposal= getSelectedProposal(); if (oldProposal instanceof ICompletionProposalExtension2) ((ICompletionProposalExtension2) oldProposal).unselected(fViewer); ICompletionProposal proposal= fFilteredProposals[index]; if (proposal instanceof ICompletionProposalExtension2) ((ICompletionProposalExtension2) proposal).selected(fViewer, smartToggle); fLastProposal= proposal; fProposalTable.setSelection(index); fProposalTable.showSelection(); if (fAdditionalInfoController != null) fAdditionalInfoController.handleTableSelectionChanged(); }