org.eclipse.jface.text.IInformationControlCreator Java Examples

The following examples show how to use org.eclipse.jface.text.IInformationControlCreator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdditionalInfoController.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);
	setCloser(new Closer());
	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);
}
 
Example #2
Source File: TLASourceViewerConfiguration.java    From tlaplus with MIT License 6 votes vote down vote up
/**
   * Content assistant
   */
  public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
  {
      ContentAssistant assistant = new ContentAssistant();
      assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
      assistant.setContentAssistProcessor(new TLACompletionProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
      assistant.setContentAssistProcessor(new PCalCompletionProcessor(), TLAPartitionScanner.TLA_PCAL);
      assistant.enableColoredLabels(true);
      assistant.enableAutoActivation(true);
      assistant.setAutoActivationDelay(500);
assistant.setInformationControlCreator(new IInformationControlCreator() {
	public IInformationControl createInformationControl(final Shell parent) {
		return new DefaultInformationControl(parent, (DefaultInformationControl.IInformationPresenter) null);
	}
});
assistant.setSorter(new ICompletionProposalSorter() {
	public int compare(ICompletionProposal p1, ICompletionProposal p2) {
		return 0;
	}
});
      assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
      assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
      assistant.setContextInformationPopupBackground(TLAEditorActivator.getDefault().getTLAColorProvider().getColor(
              TLAColorProvider.CONTENT_ASSIST_BACKGROUND_KEY));
      return assistant;
  }
 
Example #3
Source File: ConfigPropertyWidgetFile.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates the content assistant.
 * 
 * @return the content assistant
 */
private SubjectControlContentAssistant createContentAssistant() {

  final SubjectControlContentAssistant contentAssistant = new SubjectControlContentAssistant();

  contentAssistant
          .setRestoreCompletionProposalSize(CheckstyleUIPlugin.getDefault().getDialogSettings());

  IContentAssistProcessor processor = new PropertiesContentAssistProcessor();
  contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
  contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
  contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
    /*
     * @see IInformationControlCreator#createInformationControl(Shell)
     */
    @Override
    public IInformationControl createInformationControl(Shell parent) {
      return new DefaultInformationControl(parent);
    }
  });

  return contentAssistant;
}
 
Example #4
Source File: ResolvablePropertyEditDialog.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates the content assistant.
 *
 * @return the content assistant
 */
private SubjectControlContentAssistant createContentAssistant() {

  final SubjectControlContentAssistant contentAssistant = new SubjectControlContentAssistant();

  contentAssistant
          .setRestoreCompletionProposalSize(CheckstyleUIPlugin.getDefault().getDialogSettings());

  IContentAssistProcessor processor = new PropertiesContentAssistProcessor();
  contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
  contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
  contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
    /*
     * @see IInformationControlCreator#createInformationControl(Shell)
     */
    @Override
    public IInformationControl createInformationControl(Shell parent) {
      return new DefaultInformationControl(parent);
    }
  });

  return contentAssistant;
}
 
Example #5
Source File: PropertiesFileSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString());
		}
	};
}
 
Example #6
Source File: AnnotationWithQuickFixesHover.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	return new AnnotationInformationControl(parent, EditorsUI.getTooltipAffordanceString()) {

		@Override
		public IInformationControlCreator getInformationPresenterControlCreator() {
			return fPresenterControlCreator;
		}
	};
}
 
Example #7
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public IInformationControlCreator getHoverControlCreator()
{
	if (activeTextHover instanceof ITextHoverExtension)
	{
		return ((ITextHoverExtension) activeTextHover).getHoverControlCreator();
	}
	return new IInformationControlCreator()
	{
		public IInformationControl createInformationControl(Shell parent)
		{
			return createTextHoverInformationControl(parent, EditorsUI.getTooltipAffordanceString());
		}
	};
}
 
Example #8
Source File: BrowserControlCreator.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected IInformationControl doCreateBrowserInformationControl(Shell parent, String font) {
	if(statusFieldText == null) {
		return new org.eclipse.jface.internal.text.html.BrowserInformationControl(parent, font, true);
	} else {
		return new org.eclipse.jface.internal.text.html.BrowserInformationControl(parent, font, 
			statusFieldText) {
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return getEnrichedInformationPresenterControlCreator();
			}
		};
	}
}
 
Example #9
Source File: AbstractJavaEditorTextHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Delegate method for {@link JavaInformationProvider#getInformationPresenterControlCreator()}
 * 
 * @return the information control creator or null if none is available
 * @since 3.4
 */
public IInformationControlCreator getInformationPresenterControlCreator() {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell shell) {
			return new DefaultInformationControl(shell, true);
		}
	};
}
 
Example #10
Source File: AbstractLangSourceViewerConfiguration.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected IInformationControlCreator getInformationPresenterControlCreator(
		@SuppressWarnings("unused") ISourceViewer sourceViewer) {
	return new IInformationControlCreator() {
		@Override
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent, true);
		}
	};
}
 
Example #11
Source File: AbstractAnnotationHover.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	return new AnnotationInformationControl(parent, EditorsUI.getTooltipAffordanceString()) {
		/*
		 * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator()
		 */
		@Override
		public IInformationControlCreator getInformationPresenterControlCreator() {
			return fPresenterControlCreator;
		}
	};
}
 
Example #12
Source File: AbstractCommonTextHover.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public IInformationControlCreator getHoverControlCreator()
{
	return new IInformationControlCreator()
	{
		public IInformationControl createInformationControl(Shell parent)
		{
			return new DefaultInformationControl(parent, AbstractCommonTextHover.this.getTooltipAffordanceString());
		}
	};
}
 
Example #13
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * getInformationPresenterControlCreator
 * 
 * @param sourceViewer
 * @return
 */
private IInformationControlCreator getInformationPresenterControlCreator(ISourceViewer sourceViewer)
{
	return new IInformationControlCreator()
	{
		public IInformationControl createInformationControl(Shell parent)
		{
			return new DefaultInformationControl(parent, true);
		}
	};
}
 
Example #14
Source File: HierarchyInformationPresenter.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected static IInformationControlCreator getHierarchyPresenterControlCreator() {
	return new IInformationControlCreator() {
		@Override
		public IInformationControl createInformationControl(Shell parent) {
			int shellStyle = SWT.RESIZE;
			int treeStyle = SWT.V_SCROLL | SWT.H_SCROLL;
			HierarchyInformationControl hierarchyInformationControl = new HierarchyInformationControl(parent,
					shellStyle, treeStyle);
			return hierarchyInformationControl;
		}
	};
}
 
Example #15
Source File: JavaDebugHoverProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public IInformationControlCreatorProvider getInformationControlCreatorProvider(ITextViewer textViewer,
		IRegion hoverRegion) {

	if (!IS_JAVA_DEBUG_HOVER_AVAILABLE)
		return null;

	final JavaDebugHover javaDebugHover = injector.getInstance(JavaDebugHover.class);
	final Object hoverInfo = javaDebugHover.getHoverInfo2(textViewer, hoverRegion);
	if (hoverInfo == null)
		return null;

	return new IEObjectHoverProvider.IInformationControlCreatorProvider2() {
		@Override
		public IInformationControlCreator getHoverControlCreator() {
			return javaDebugHover.getHoverControlCreator();
		}

		@Override
		public Object getInfo() {
			return hoverInfo;
		}

		@Override
		public IInformationControlCreator getInformationPresenterControlCreator() {
			return javaDebugHover.getInformationPresenterControlCreator();
		}
	};
}
 
Example #16
Source File: BestMatchHover.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
	if(matchedHover == null) {
		return null;
	}
	return matchedHover.getInformationPresenterControlCreator();
}
 
Example #17
Source File: AbstractAnnotationHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	return new AnnotationInformationControl(parent, EditorsUI.getTooltipAffordanceString()) {
		/*
		 * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator()
		 */
		@Override
		public IInformationControlCreator getInformationPresenterControlCreator() {
			return fPresenterControlCreator;
		}
	};
}
 
Example #18
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer)
{
	return new IInformationControlCreator()
	{
		public IInformationControl createInformationControl(Shell parent)
		{
			return new ThemedInformationControl(parent, SWT.NONE, new HTMLTextPresenter(true));
		}
	};
}
 
Example #19
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent, false);
		}
	};
}
 
Example #20
Source File: TexSourceViewerConfiguration.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
public IInformationControlCreator getInformationControlCreator
(ISourceViewer sourceViewer) {
    return new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            return new DefaultInformationControl(parent, presenter);
        }
    };
}
 
Example #21
Source File: AbstractAnnotationHover.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	return new AnnotationInformationControl(parent, EditorsUI.getTooltipAffordanceString()) {
		/*
		 * @see org.eclipse.jface.text.IInformationControlExtension5#
		 * getInformationPresenterControlCreator()
		 */
		@Override
		public IInformationControlCreator getInformationPresenterControlCreator() {
			return fPresenterControlCreator;
		}
	};
}
 
Example #22
Source File: ScriptDebugHover.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IInformationControlCreator getHoverControlCreator( )
{
	return new IInformationControlCreator( ) {

		public IInformationControl createInformationControl( Shell parent )
		{
			return new DefaultInformationControl( parent,
					EditorsUI.getTooltipAffordanceString( ) );
		}
	};
}
 
Example #23
Source File: JavaCorrectionAssistant.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IInformationControlCreator getInformationControlCreator() {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString());
		}
	};
}
 
Example #24
Source File: ModulaSourceViewerConfiguration.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
    IInformationControlCreator icc = new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            return new DefaultInformationControl(parent, true);
        }
    }; 
    InformationPresenter ip = new InformationPresenter(icc);
    ModulaInformationProvider mip = new ModulaInformationProvider(this);
    ip.setInformationProvider(mip, IModulaPartitions.M2_CONTENT_TYPE_DEFAULT);
    return ip;
    
}
 
Example #25
Source File: AbstractDocumentationHover.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public IInformationControlCreator getInformationPresenterControlCreator()
{
	if (fPresenterControlCreator == null)
	{
		fPresenterControlCreator = new PresenterControlCreator(this);
	}
	return fPresenterControlCreator;
}
 
Example #26
Source File: InformationControlManager.java    From JDeodorant with MIT License 5 votes vote down vote up
@Override
protected void computeInformation() {
	Display display = getSubjectControl().getDisplay();
	Point mouseLocation = display.getCursorLocation();
	mouseLocation = getSubjectControl().toControl(mouseLocation);

	// Compute information input
	Object info = informationProvider.getInformation(mouseLocation);

	// Find an information control creator for the computed information input
	IInformationControlCreator customControlCreator = null;
	for (ICustomInformationControlCreator controlCreator : customControlCreators) {
		if (controlCreator.isSupported(info)) {
			customControlCreator = controlCreator;
			break;
		}
	}
	setCustomInformationControlCreator(customControlCreator);

	// Convert to String for default TextLabelInformationControl
	// (Fallback, if no custom control creator has been found)
	//if (info != null && customControlCreator == null) {
	//	info = info.toString();
	//}

	// Trigger the presentation of the computed information
	if(customControlCreator != null){
	Rectangle area = informationProvider.getArea(mouseLocation);
	setInformation(info, area);
	}
}
 
Example #27
Source File: JavaSourceViewerConfiguration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IInformationControlCreator getHierarchyPresenterControlCreator() {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			int shellStyle= SWT.RESIZE;
			int treeStyle= SWT.V_SCROLL | SWT.H_SCROLL;
			return new HierarchyInformationControl(parent, shellStyle, treeStyle);
		}
	};
}
 
Example #28
Source File: TypeScriptCompletionProposal.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationControlCreator() {
	Shell shell = getActiveWorkbenchShell();
	if (shell == null || !BrowserInformationControl.isAvailable(shell))
		return null;
	if (tsControlCreator == null) {
		PresenterControlCreator presenterControlCreator = new PresenterControlCreator();
		tsControlCreator = new HoverControlCreator(presenterControlCreator, true);
	}
	return tsControlCreator;
}
 
Example #29
Source File: TypeScriptBrowserInformationControl.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
	// Hack: We don't wan't to have auto-enrichment when the mouse moves
	// into the hover,
	// but we do want F2 to persist the hover. The framework has no way to
	// distinguish the
	// two requests, so we have to implement this aspect.
	for (StackTraceElement element : Thread.currentThread().getStackTrace()) {
		if ("canMoveIntoInformationControl".equals(element.getMethodName()) //$NON-NLS-1$
				&& "org.eclipse.jface.text.AbstractHoverInformationControlManager".equals(element.getClassName())) //$NON-NLS-1$
			return null; // do not enrich bracket hover
	}
	return super.getInformationPresenterControlCreator();
}
 
Example #30
Source File: ControlContentAssistHelper.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static SubjectControlContentAssistant createJavaContentAssistant(IContentAssistProcessor processor) {
	final SubjectControlContentAssistant contentAssistant= new SubjectControlContentAssistant();

	contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);

	ContentAssistPreference.configure(contentAssistant, JavaPlugin.getDefault().getPreferenceStore());
	contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
	contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString());
		}
	});

	return contentAssistant;
}