org.eclipse.jface.internal.text.html.BrowserInformationControl Java Examples

The following examples show how to use org.eclipse.jface.internal.text.html.BrowserInformationControl. 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: JavadocHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString= fAdditionalInfoAffordance ? JavaPlugin.getAdditionalInfoAffordanceString() : EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font= PreferenceConstants.APPEARANCE_JAVADOC_FONT;
		BrowserInformationControl iControl= new BrowserInformationControl(parent, font, tooltipAffordanceString) {
			/*
			 * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator()
			 */
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
Example #2
Source File: AbstractDocumentationHover.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public IInformationControl doCreateInformationControl(Shell parent)
{
	if (BrowserInformationControl.isAvailable(parent))
	{
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		CustomBrowserInformationControl iControl = new CustomBrowserInformationControl(parent, null, tbm);
		iControl.setBackgroundColor(documentationHover.getBackgroundColor());
		iControl.setForegroundColor(documentationHover.getForegroundColor());
		documentationHover.populateToolbarActions(tbm, iControl);
		tbm.update(true);
		documentationHover.installLinkListener(iControl);
		return iControl;
	}
	else
	{
		return new DefaultInformationControl(parent, true);
	}
}
 
Example #3
Source File: GamlHoverProvider.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(final Shell parent) {

	final String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		final String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME:
																// PreferenceConstants.APPEARANCE_JAVADOC_FONT;
		final IXtextBrowserInformationControl iControl =
				new GamlInformationControl(parent, font, tooltipAffordanceString) {

				};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
Example #4
Source File: HelpHoverProvider.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont";

		boolean areHoverDocsScrollable = true;

		// resizable flag of BrowserInformationControl causes the scrollbar to be always
		// enabled.
		BrowserInformationControl iControl = new BrowserInformationControl(parent, font,
				areHoverDocsScrollable) {
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
Example #5
Source File: CustomCSSHelpHoverProvider.java    From solidity-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI
			.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont";
		BrowserInformationControl iControl = new BrowserInformationControl(
				parent, font, false) {
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent,
				tooltipAffordanceString);
	}
}
 
Example #6
Source File: HoverControlCreator.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = "Press F2 for focus";
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = JFaceResources.DIALOG_FONT;
		BrowserInformationControl iControl = new BrowserInformationControl(
				parent, font, tooltipAffordanceString) {
			/*
			 * @see org.eclipse.jface.text.IInformationControlExtension5#
			 * getInformationPresenterControlCreator()
			 */
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent,
				tooltipAffordanceString);
	}
}
 
Example #7
Source File: XbaseHoverProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont";
		IXtextBrowserInformationControl iControl = new XbaseInformationControl(parent, font,
				tooltipAffordanceString, xbaseHoverConfiguration) {
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
Example #8
Source File: DefaultEObjectHoverProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME: PreferenceConstants.APPEARANCE_JAVADOC_FONT;
		IXtextBrowserInformationControl iControl = new XtextBrowserInformationControl(parent, font,
				tooltipAffordanceString) {
			/*
			 * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator()
			 */
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
Example #9
Source File: JavadocHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public ForwardAction(BrowserInformationControl infoControl) {
	fInfoControl= infoControl;
	setText(JavaHoverMessages.JavadocHover_forward);
	ISharedImages images= PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
	setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));

	update();
}
 
Example #10
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 #11
Source File: PresenterControlCreator.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	if (BrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		TypeScriptBrowserInformationControl control = new TypeScriptBrowserInformationControl(
				parent, null, tbm);
		tbm.update(true);
		addLinkListener(control);
		return control;
	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example #12
Source File: JavadocHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public BackAction(BrowserInformationControl infoControl) {
	fInfoControl= infoControl;
	setText(JavaHoverMessages.JavadocHover_back);
	ISharedImages images= PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
	setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));

	update();
}
 
Example #13
Source File: AbstractJavaCompletionProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public IInformationControlCreator getInformationControlCreator() {
	Shell shell= JavaPlugin.getActiveWorkbenchShell();
	if (shell == null || !BrowserInformationControl.isAvailable(shell))
		return null;

	if (fCreator == null) {
		/*
		 * FIXME: Take control creators (and link handling) out of JavadocHover,
		 * see https://bugs.eclipse.org/bugs/show_bug.cgi?id=232024
		 */
		JavadocHover.PresenterControlCreator presenterControlCreator= new JavadocHover.PresenterControlCreator(getSite());
		fCreator= new JavadocHover.HoverControlCreator(presenterControlCreator, true);
	}
	return fCreator;
}
 
Example #14
Source File: DefaultEObjectHoverProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	if (BrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
		String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME: mPreferenceConstants.APPEARANCE_JAVADOC_FONT;
		IXtextBrowserInformationControl control = new XtextBrowserInformationControl(parent, font, tbm);
		configureControl(control, tbm, font);
		return control;
	} else {
		return new DefaultInformationControl(parent,true);
	}
}
 
Example #15
Source File: JavadocHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public OpenDeclarationAction(BrowserInformationControl infoControl) {
	fInfoControl= infoControl;
	setText(JavaHoverMessages.JavadocHover_openDeclaration);
	JavaPluginImages.setLocalImageDescriptors(this, "goto_input.gif"); //$NON-NLS-1$ //TODO: better images
}
 
Example #16
Source File: JavadocHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public ShowInJavadocViewAction(BrowserInformationControl infoControl) {
	fInfoControl= infoControl;
	setText(JavaHoverMessages.JavadocHover_showInJavadoc);
	setImageDescriptor(JavaPluginImages.DESC_OBJS_JAVADOCTAG); //TODO: better image
}
 
Example #17
Source File: JavadocHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	if (BrowserInformationControl.isAvailable(parent)) {
		ToolBarManager tbm= new ToolBarManager(SWT.FLAT);
		String font= PreferenceConstants.APPEARANCE_JAVADOC_FONT;
		BrowserInformationControl iControl= new BrowserInformationControl(parent, font, tbm);

		final BackAction backAction= new BackAction(iControl);
		backAction.setEnabled(false);
		tbm.add(backAction);
		final ForwardAction forwardAction= new ForwardAction(iControl);
		tbm.add(forwardAction);
		forwardAction.setEnabled(false);

		final ShowInJavadocViewAction showInJavadocViewAction= new ShowInJavadocViewAction(iControl);
		tbm.add(showInJavadocViewAction);
		final OpenDeclarationAction openDeclarationAction= new OpenDeclarationAction(iControl);
		tbm.add(openDeclarationAction);

		final SimpleSelectionProvider selectionProvider= new SimpleSelectionProvider();
		if (fSite != null) {
			OpenAttachedJavadocAction openAttachedJavadocAction= new OpenAttachedJavadocAction(fSite);
			openAttachedJavadocAction.setSpecialSelectionProvider(selectionProvider);
			openAttachedJavadocAction.setImageDescriptor(JavaPluginImages.DESC_ELCL_OPEN_BROWSER);
			openAttachedJavadocAction.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_OPEN_BROWSER);
			selectionProvider.addSelectionChangedListener(openAttachedJavadocAction);
			selectionProvider.setSelection(new StructuredSelection());
			tbm.add(openAttachedJavadocAction);
		}

		IInputChangedListener inputChangeListener= new IInputChangedListener() {
			public void inputChanged(Object newInput) {
				backAction.update();
				forwardAction.update();
				if (newInput == null) {
					selectionProvider.setSelection(new StructuredSelection());
				} else if (newInput instanceof BrowserInformationControlInput) {
					BrowserInformationControlInput input= (BrowserInformationControlInput) newInput;
					Object inputElement= input.getInputElement();
					selectionProvider.setSelection(new StructuredSelection(inputElement));
					boolean isJavaElementInput= inputElement instanceof IJavaElement;
					showInJavadocViewAction.setEnabled(isJavaElementInput);
					openDeclarationAction.setEnabled(isJavaElementInput);
				}
			}
		};
		iControl.addInputChangeListener(inputChangeListener);

		tbm.update(true);

		addLinkListener(iControl);
		return iControl;

	} else {
		return new DefaultInformationControl(parent, true);
	}
}
 
Example #18
Source File: HoverControlCreator.java    From typescript.java with MIT License 4 votes vote down vote up
protected void addLinkListener(BrowserInformationControl control) {
	HoverLocationListener.addLinkListener(control);
}
 
Example #19
Source File: IDEHoverLocationListener.java    From typescript.java with MIT License 4 votes vote down vote up
public IDEHoverLocationListener(BrowserInformationControl control, ITypeScriptHoverInfoProvider provider) {
	super(control);
	this.provider = provider;
}
 
Example #20
Source File: IDEHoverControlCreator.java    From typescript.java with MIT License 4 votes vote down vote up
@Override
protected void addLinkListener(BrowserInformationControl control) {
	HoverLocationListener.addLinkListener(control,
			new IDEHoverLocationListener(control, provider));
}
 
Example #21
Source File: HoverLocationListener.java    From typescript.java with MIT License 4 votes vote down vote up
public static void addLinkListener(final BrowserInformationControl control,
		LocationListener listener) {
	control.addLocationListener(listener);
}
 
Example #22
Source File: HoverLocationListener.java    From typescript.java with MIT License 4 votes vote down vote up
public static void addLinkListener(final BrowserInformationControl control) {
	addLinkListener(control, new HoverLocationListener(control));
}
 
Example #23
Source File: HoverLocationListener.java    From typescript.java with MIT License 4 votes vote down vote up
public HoverLocationListener(BrowserInformationControl control) {
	this.control = control;
}
 
Example #24
Source File: XtextBrowserInformationControlAdapter.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
XtextBrowserInformationControlAdapter(BrowserInformationControl control) {
	this.control = control;
}
 
Example #25
Source File: DefaultEObjectHoverProvider.java    From xtext-eclipse with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * @noreference This method is not intended to be referenced by clients.
 * @nooverride This method is not intended to be re-implemented or extended by clients.
 */
protected void addLinkListener(final BrowserInformationControl control) {
	addLinkListener(new XtextBrowserInformationControlAdapter(control));
}