/** * Sets the information control replacer for this manager and disposes the * old one if set. * * @param replacer the information control replacer for this manager, or * <code>null</code> if no information control replacing should * take place * @since 3.4 */ void setInformationControlReplacer(InformationControlReplacer replacer) { if (fInformationControlReplacer != null) fInformationControlReplacer.dispose(); fInformationControlReplacer= replacer; }
/** * @param input the delayed input, or <code>null</code> to request cancellation */ public void setDelayedInput(Object input) { fReplacableInformation= input; if (! isReplacing()) { fDelayedInformationSet= true; } else if (getCurrentInformationControl2() instanceof IInformationControlExtension2) { ((IInformationControlExtension2) getCurrentInformationControl2()).setInput(input); } else if (getCurrentInformationControl2() != null) { getCurrentInformationControl2().setInformation(input.toString()); } }
/** * @return the current information control, or <code>null</code> if none available */ public IInformationControl getCurrentInformationControl2() { return getInternalAccessor().getCurrentInformationControl(); }
IInformationControl informationControl= getInformationControl(); controlBounds.height= Math.max(controlBounds.height, MIN_HEIGHT); getInternalAccessor().cropToClosestMonitor(controlBounds); informationControl.setSize(size.x, size.y); showInformationControl(subjectArea);
iControl= null; if (getInformationControlReplacer() != null) { iControl= getInformationControlReplacer().getCurrentInformationControl2(); if ((iControl instanceof IInformationControlExtension5 && !((IInformationControlExtension5) iControl).isVisible())) { return false; int margin= getInformationControlReplacer().getKeepUpMargin(); Geometry.expand(totalBounds, margin, margin, margin, margin);
@Override public void hideInformationControl() { try { super.hideInformationControl(); } finally { if (fTextViewer != null) fTextViewer.releaseWidgetToken(this); } }
/** * Returns whether this popup has the focus. * * @return <code>true</code> if the popup has the focus */ public boolean hasFocus() { if (Helper.okToUse(fProposalShell)) { if ((fProposalShell.getDisplay().getActiveShell() == fProposalShell)) return true; /* * We have to delegate this query to the additional info controller * as well, since the content assistant is the widget token owner * and its closer does not know that the additional info control can * now also take focus. */ if (fAdditionalInfoController != null) { IInformationControl informationControl= fAdditionalInfoController.getCurrentInformationControl2(); if (informationControl != null && informationControl.isFocusControl()) return true; InformationControlReplacer replacer= fAdditionalInfoController.getInternalAccessor().getInformationControlReplacer(); if (replacer != null) { informationControl= replacer.getCurrentInformationControl2(); if (informationControl != null && informationControl.isFocusControl()) return true; } } } return false; }
/** * Tells whether this manager's information control is currently being replaced. * * @return <code>true</code> if a replace is in progress * @since 3.4 */ boolean isReplaceInProgress() { return fInformationControlReplacer != null && fInformationControlReplacer.isReplacing(); }
@Override protected void handleInformationControlDisposed() { try { super.handleInformationControlDisposed(); } finally { if (fTextViewer != null) fTextViewer.releaseWidgetToken(this); } }
/** * 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 */ AdditionalInfoController(IInformationControlCreator creator, int delay) { super(creator); fDelay= delay; setAnchor(ANCHOR_RIGHT); setFallbackAnchors(new Anchor[] { ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM }); /* * Adjust the location by one pixel towards the proposal popup, so that the single pixel * border of the additional info popup overlays with the border of the popup. This avoids * having a double black line. */ int spacing= -1; setMargins(spacing, spacing); // see also adjustment in #computeLocation InformationControlReplacer replacer= new InformationControlReplacer(new DefaultPresenterControlCreator()); getInternalAccessor().setInformationControlReplacer(replacer); }
@Override public void install(Control control) { if (fProposalTable == control) { // already installed return; } super.install(control.getShell()); Assert.isTrue(control instanceof Table); fProposalTable= (Table) control; fProposalTable.addSelectionListener(fSelectionListener); getInternalAccessor().getInformationControlReplacer().install(fProposalTable); fTimer= new Timer(fProposalTable.getDisplay(), fDelay) { @Override protected void showInformation(ICompletionProposal proposal, Object info) { InformationControlReplacer replacer= getInternalAccessor().getInformationControlReplacer(); if (replacer != null) replacer.hideInformationControl(); AdditionalInfoController.this.showInformation(proposal, info); } }; }
IInformationControl informationControl= getInformationControl(); controlBounds.height= Math.max(controlBounds.height, MIN_HEIGHT); getInternalAccessor().cropToClosestMonitor(controlBounds); informationControl.setSize(size.x, size.y); showInformationControl(subjectArea);
iControl= null; if (getInformationControlReplacer() != null) { iControl= getInformationControlReplacer().getCurrentInformationControl2(); if ((iControl instanceof IInformationControlExtension5 && !((IInformationControlExtension5) iControl).isVisible())) { return false; int margin= getInformationControlReplacer().getKeepUpMargin(); Geometry.expand(totalBounds, margin, margin, margin, margin);
@Override public void hideInformationControl() { try { super.hideInformationControl(); } finally { if (fTextViewer != null) fTextViewer.releaseWidgetToken(this); } }
/** * Returns whether this popup has the focus. * * @return <code>true</code> if the popup has the focus */ public boolean hasFocus() { if (Helper.okToUse(fProposalShell)) { if ((fProposalShell.getDisplay().getActiveShell() == fProposalShell)) return true; /* * We have to delegate this query to the additional info controller * as well, since the content assistant is the widget token owner * and its closer does not know that the additional info control can * now also take focus. */ if (fAdditionalInfoController != null) { IInformationControl informationControl= fAdditionalInfoController.getCurrentInformationControl2(); if (informationControl != null && informationControl.isFocusControl()) return true; InformationControlReplacer replacer= fAdditionalInfoController.getInternalAccessor().getInformationControlReplacer(); if (replacer != null) { informationControl= replacer.getCurrentInformationControl2(); if (informationControl != null && informationControl.isFocusControl()) return true; } } } return false; }
/** * Tells whether this manager's information control is currently being replaced. * * @return <code>true</code> if a replace is in progress * @since 3.4 */ boolean isReplaceInProgress() { return fInformationControlReplacer != null && fInformationControlReplacer.isReplacing(); }
@Override protected void handleInformationControlDisposed() { try { super.handleInformationControlDisposed(); } finally { if (fTextViewer != null) fTextViewer.releaseWidgetToken(this); } }
/** * 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 */ AdditionalInfoController(IInformationControlCreator creator, int delay) { super(creator); fDelay= delay; setAnchor(ANCHOR_RIGHT); setFallbackAnchors(new Anchor[] { ANCHOR_RIGHT, ANCHOR_LEFT, ANCHOR_BOTTOM }); /* * Adjust the location by one pixel towards the proposal popup, so that the single pixel * border of the additional info popup overlays with the border of the popup. This avoids * having a double black line. */ int spacing= -1; setMargins(spacing, spacing); // see also adjustment in #computeLocation InformationControlReplacer replacer= new InformationControlReplacer(new DefaultPresenterControlCreator()); getInternalAccessor().setInformationControlReplacer(replacer); }
@Override public void install(Control control) { if (fProposalTable == control) { // already installed return; } super.install(control.getShell()); Assert.isTrue(control instanceof Table); fProposalTable= (Table) control; fProposalTable.addSelectionListener(fSelectionListener); getInternalAccessor().getInformationControlReplacer().install(fProposalTable); fTimer= new Timer(fProposalTable.getDisplay(), fDelay) { @Override protected void showInformation(ICompletionProposal proposal, Object info) { InformationControlReplacer replacer= getInternalAccessor().getInformationControlReplacer(); if (replacer != null) replacer.hideInformationControl(); AdditionalInfoController.this.showInformation(proposal, info); } }; }
/** * @param input the delayed input, or <code>null</code> to request cancellation */ public void setDelayedInput(Object input) { fReplacableInformation= input; if (! isReplacing()) { fDelayedInformationSet= true; } else if (getCurrentInformationControl2() instanceof IInformationControlExtension2) { ((IInformationControlExtension2) getCurrentInformationControl2()).setInput(input); } else if (getCurrentInformationControl2() != null) { getCurrentInformationControl2().setInformation(input.toString()); } }