org.eclipse.jface.text.IInformationControl Java Examples

The following examples show how to use org.eclipse.jface.text.IInformationControl. 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: JavaScriptLightWeightEditor.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * Install everything necessary to get document folding working and enable
 * document folding
 * 
 * @param sourceViewer
 */
private void installProjectionSupport() {

	ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
	fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
	fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
	fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
	fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent);
		}
	});
	fProjectionSupport.install();

	if (isFoldingEnabled()) {
		projectionViewer.doOperation(ProjectionViewer.TOGGLE);
	}
}
 
Example #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
Source File: CheckstyleMarkerFilterDialog.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 RegExContentAssistProcessor(true);
  contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
  contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
  contentAssistant.setInformationControlCreator(new IInformationControlCreator() {
    /*
     * @see org.eclipse.jface.text.IInformationControlCreator# createInformationControl(
     * org.eclipse.swt.widgets.Shell)
     */
    @Override
    public IInformationControl createInformationControl(Shell parent) {
      return new DefaultInformationControl(parent);
    }
  });

  return contentAssistant;
}
 
Example #9
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 #10
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 #11
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 #12
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 #13
Source File: PopupCloser.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public boolean isAdditionalInfoInFocus()
{
	if (fAdditionalInfoController != null)
	{
		IInformationControl control2 = fAdditionalInfoController.getCurrentInformationControl2();
		return control2 != null && control2.isFocusControl();
	}
	return false;
}
 
Example #14
Source File: AbstractJavaEditorTextHover.java    From Eclipse-Postfix-Code-Completion 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 #15
Source File: JavaChangeHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IInformationControlCreator getHoverControlCreator() {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			fInformationControl= new ChangeHoverInformationControl(parent, false, fOrientation, fPartition, EditorsUI.getTooltipAffordanceString());
			fInformationControl.setHorizontalScrollPixel(fLastScrollIndex);
			return fInformationControl;
		}
	};
}
 
Example #16
Source File: TemplateInformationControlCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public IInformationControl createInformationControl(Shell parent) {
	fControl= new SourceViewerInformationControl(parent, false, fOrientation, JavaPlugin.getAdditionalInfoAffordanceString());
	fControl.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			fControl= null;
		}
	});
	return fControl;
}
 
Example #17
Source File: PropertiesCorrectionAssistant.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 #18
Source File: AbstractAnnotationHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean canReuse(IInformationControl control) {
	if (!super.canReuse(control))
		return false;

	if (control instanceof IInformationControlExtension4)
		((IInformationControlExtension4) control).setStatusText(EditorsUI.getTooltipAffordanceString());

	return true;
}
 
Example #19
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 #20
Source File: AnnotationExpansionControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 *
 */
public HoverManager() {
	super(new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent);
		}
	});

	setMargins(5, 10);
	setAnchor(ANCHOR_BOTTOM);
	setFallbackAnchors(new Anchor[] {ANCHOR_BOTTOM, ANCHOR_LEFT, ANCHOR_RIGHT} );
}
 
Example #21
Source File: AbstractDocumentationHover.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public boolean canReuse(IInformationControl control)
{
	if (!super.canReuse(control))
	{
		return false;
	}

	if (control instanceof IInformationControlExtension4)
	{
		((IInformationControlExtension4) control).setStatusText(EditorsUI.getTooltipAffordanceString());
	}

	return true;
}
 
Example #22
Source File: JavadocHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean canReuse(IInformationControl control) {
	if (!super.canReuse(control))
		return false;

	if (control instanceof IInformationControlExtension4) {
		String tooltipAffordanceString= fAdditionalInfoAffordance ? JavaPlugin.getAdditionalInfoAffordanceString() : EditorsUI.getTooltipAffordanceString();
		((IInformationControlExtension4)control).setStatusText(tooltipAffordanceString);
	}

	return true;
}
 
Example #23
Source File: NLSStringHover.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	ToolBarManager tbm= new ToolBarManager(SWT.FLAT);
	NLSHoverControl iControl= new NLSHoverControl(parent, tbm);
	OpenPropertiesFileAction openPropertiesFileAction= new OpenPropertiesFileAction(iControl);
	tbm.add(openPropertiesFileAction);
	tbm.update(true);
	return iControl;
}
 
Example #24
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 #25
Source File: AdditionalInfoController.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl)
{
	// at least as big as the proposal table
	Point sizeConstraint = super.computeSizeConstraints(subjectControl, informationControl);
	Point size = subjectControl.getShell().getSize();

	// AbstractInformationControlManager#internalShowInformationControl(Rectangle, Object) adds trims
	// to the computed constraints. Need to remove them here, to make the outer bounds of the additional
	// info shell fit the bounds of the proposal shell:
	if (fInformationControl instanceof IInformationControlExtension3)
	{
		Rectangle shellTrim = ((IInformationControlExtension3) fInformationControl).computeTrim();
		size.x -= shellTrim.width;
		size.y -= shellTrim.height;
	}

	if (sizeConstraint.x < size.x)
	{
		sizeConstraint.x = size.x;
	}
	if (sizeConstraint.y < size.y)
	{
		sizeConstraint.y = size.y;
	}
	sizeConstraint.y = 450;
	return sizeConstraint;
}
 
Example #26
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 #27
Source File: TypeScriptSourceViewerConfiguration.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Returns the outline presenter control creator. The creator is a factory
 * creating outline presenter controls for the given source viewer. This
 * implementation always returns a creator for
 * <code>JavaOutlineInformationControl</code> instances.
 *
 * @param sourceViewer
 *            the source viewer to be configured by this configuration
 * @param commandId
 *            the ID of the command that opens this control
 * @return an information control creator
 *
 */
private IInformationControlCreator getOutlinePresenterControlCreator(final ISourceViewer sourceViewer,
		final String commandId) {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(final Shell parent) {
			int shellStyle = SWT.RESIZE;
			try {
				return new TypeScriptQuickOutlineDialog(parent, shellStyle, getTypeScriptFile());
			} catch (Exception e) {
				return null;
			}
		}
	};
}
 
Example #28
Source File: GamlProposalProvider.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationControlCreator() {
	return parent -> {
		final IInformationControl control = new DefaultInformationControl(parent, true);
		return control;

	};
}
 
Example #29
Source File: JsonSourceViewerConfiguration.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
protected IInformationControlCreator getOutlineInformationControlCreator(final String fileContentType) {
    return new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            QuickOutline dialog = new QuickOutline(parent, getEditor(), fileContentType) {

                @Override
                protected CompositeSchema getSchema() {
                    return JsonSourceViewerConfiguration.this.getSchema();
                }

            };
            return dialog;
        }
    };
}
 
Example #30
Source File: TypeScriptSourceViewerConfiguration.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Returns the implementation presenter control creator. The creator is a
 * factory creating implementation presenter controls for the given source
 * viewer.
 *
 * @param sourceViewer
 *            the source viewer to be configured by this configuration
 * @param commandId
 *            the ID of the command that opens this control
 * @return an information control creator
 *
 */
private IInformationControlCreator getImplementationPresenterControlCreator(final ISourceViewer sourceViewer) {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(final Shell parent) {
			try {
				int shellStyle = SWT.RESIZE;
				return new TypeScriptImplementationDialog(parent, shellStyle, getTypeScriptFile());
			} catch (Exception e) {
				return null;
			}
		}
	};
}