Search in sources :

Example 11 with IInformationControlCreator

use of org.eclipse.jface.text.IInformationControlCreator in project webtools.sourceediting by eclipse.

the class JSPCompletionProposal method getInformationControlCreator.

/*
	 * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getInformationControlCreator()
	 */
public IInformationControlCreator getInformationControlCreator() {
    // [277530] Use the java proposal's information control creator
    ICompletionProposal javaProposal = getJavaCompletionProposal();
    IInformationControlCreator informationControlCreator = null;
    if (javaProposal instanceof ICompletionProposalExtension3)
        informationControlCreator = ((ICompletionProposalExtension3) javaProposal).getInformationControlCreator();
    return informationControlCreator;
}
Also used : IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal) ICompletionProposalExtension3(org.eclipse.jface.text.contentassist.ICompletionProposalExtension3)

Example 12 with IInformationControlCreator

use of org.eclipse.jface.text.IInformationControlCreator in project webtools.sourceediting by eclipse.

the class TestViewerConfigurationJSP method testGetInformationControlCreator.

/**
 * Not necessary
 */
public void testGetInformationControlCreator() {
    // probably no display
    if (!fDisplayExists)
        return;
    IInformationControlCreator infoCreator = fConfig.getInformationControlCreator(fViewer);
    assertNotNull("InformationControlCreator is null", infoCreator);
}
Also used : IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator)

Example 13 with IInformationControlCreator

use of org.eclipse.jface.text.IInformationControlCreator in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method installProjectionSupport.

/**
 * Install everything necessary to get document folding working and enable
 * document folding
 */
private void installProjectionSupport() {
    ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
    fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
    // $NON-NLS-1$
    fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
    // $NON-NLS-1$
    fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
    fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {

        public IInformationControl createInformationControl(Shell parent) {
            return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
        }
    });
    fProjectionSupport.install();
    if (isFoldingEnabled())
        projectionViewer.doOperation(ProjectionViewer.TOGGLE);
}
Also used : ProjectionSupport(org.eclipse.jface.text.source.projection.ProjectionSupport) IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) Shell(org.eclipse.swt.widgets.Shell) IInformationControl(org.eclipse.jface.text.IInformationControl) DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) ProjectionViewer(org.eclipse.jface.text.source.projection.ProjectionViewer)

Example 14 with IInformationControlCreator

use of org.eclipse.jface.text.IInformationControlCreator in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method createPartControl.

/**
 * {@inheritDoc}
 * <p>
 * Use StructuredTextViewerConfiguration if a viewerconfiguration has not
 * already been set. Also initialize StructuredTextViewer.
 * </p>
 *
 * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite)
 */
public void createPartControl(Composite parent) {
    IContextService contextService = getSite().getService(IContextService.class);
    if (contextService != null)
        contextService.activateContext(EDITOR_KEYBINDING_SCOPE_ID);
    if (getSourceViewerConfiguration() == null) {
        ConfigurationAndTarget cat = createSourceViewerConfiguration();
        fViewerConfigurationTargetId = cat.getTargetId();
        StructuredTextViewerConfiguration newViewerConfiguration = cat.getConfiguration();
        setSourceViewerConfiguration(newViewerConfiguration);
    }
    super.createPartControl(parent);
    // instead of calling setInput twice, use initializeSourceViewer() to
    // handle source viewer initialization previously handled by setInput
    initializeSourceViewer();
    // update editor context menu, vertical ruler context menu, infopop
    if (getInternalModel() != null) {
        updateEditorControlsForContentType(getInternalModel().getContentTypeIdentifier());
    } else {
        updateEditorControlsForContentType(null);
    }
    // used for Show Tooltip Description
    IInformationControlCreator informationControlCreator = new IInformationControlCreator() {

        public IInformationControl createInformationControl(Shell shell) {
            boolean cutDown = false;
            int style = cutDown ? SWT.NONE : (SWT.V_SCROLL | SWT.H_SCROLL);
            return new DefaultInformationControl(shell, SWT.RESIZE | SWT.TOOL, style, new HTMLTextPresenter(cutDown));
        }
    };
    fInformationPresenter = new InformationPresenter(informationControlCreator);
    fInformationPresenter.setSizeConstraints(60, 10, true, true);
    fInformationPresenter.install(getSourceViewer());
    addReconcilingListeners(getSourceViewerConfiguration(), getTextViewer());
    fPartListener = new PartListener(this);
    getSite().getWorkbenchWindow().getPartService().addPartListener(fPartListener);
    installSemanticHighlighting();
    if (fOutlineHandler != null) {
        IInformationPresenter presenter = configureOutlinePresenter(getSourceViewer(), getSourceViewerConfiguration());
        if (presenter != null) {
            presenter.install(getSourceViewer());
            fOutlineHandler.configure(presenter);
        }
    }
    installCharacterPairing();
    ISourceViewer viewer = getSourceViewer();
    if (viewer instanceof ITextViewerExtension) {
        ((ITextViewerExtension) viewer).appendVerifyKeyListener(fPairInserter);
        fPairInserter.installCompletionListener();
    }
    if (Platform.getProduct() != null) {
        // $NON-NLS-1$);
        String viewID = Platform.getProduct().getProperty("idPerspectiveHierarchyView");
        if (viewID != null) {
            // make sure the specified view ID is known
            if (PlatformUI.getWorkbench().getViewRegistry().find(viewID) != null) {
                fShowInTargetIds = new String[] { viewID, IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.ID_RES_NAV, IPageLayout.ID_OUTLINE };
            }
        }
    }
}
Also used : DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) Point(org.eclipse.swt.graphics.Point) IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) Shell(org.eclipse.swt.widgets.Shell) ITextViewerExtension(org.eclipse.jface.text.ITextViewerExtension) HTMLTextPresenter(org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter) IContextService(org.eclipse.ui.contexts.IContextService) IInformationPresenter(org.eclipse.jface.text.information.IInformationPresenter) IInformationPresenter(org.eclipse.jface.text.information.IInformationPresenter) InformationPresenter(org.eclipse.jface.text.information.InformationPresenter) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) IPartListener(org.eclipse.ui.IPartListener)

Example 15 with IInformationControlCreator

use of org.eclipse.jface.text.IInformationControlCreator in project xtext-xtend by eclipse.

the class DerivedSourceView method createSourceViewer.

@Override
protected SourceViewer createSourceViewer(Composite parent) {
    IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
    IOverviewRuler overviewRuler = new OverviewRuler(defaultMarkerAnnotationAccess, OVERVIEW_RULER_WIDTH, getSharedTextColors());
    AnnotationRulerColumn annotationRulerColumn = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, defaultMarkerAnnotationAccess);
    List<AnnotationPreference> annotationPreferences = markerAnnotationPreferences.getAnnotationPreferences();
    for (AnnotationPreference annotationPreference : annotationPreferences) {
        String key = annotationPreference.getVerticalRulerPreferenceKey();
        boolean showAnnotation = true;
        if (key != null && store.contains(key)) {
            showAnnotation = store.getBoolean(key);
        }
        if (showAnnotation) {
            annotationRulerColumn.addAnnotationType(annotationPreference.getAnnotationType());
        }
    }
    annotationRulerColumn.addAnnotationType(Annotation.TYPE_UNKNOWN);
    lineNumberRulerColumn = new LineNumberRulerColumn();
    CompositeRuler compositeRuler = new CompositeRuler();
    compositeRuler.addDecorator(0, annotationRulerColumn);
    compositeRuler.addDecorator(1, lineNumberRulerColumn);
    javaSourceViewer = new JavaSourceViewer(parent, compositeRuler, overviewRuler, true, SWT.V_SCROLL | SWT.H_SCROLL, store);
    javaSourceViewerConfiguration = new SimpleJavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, true) {

        @Override
        public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
            return new IInformationControlCreator() {

                @Override
                public IInformationControl createInformationControl(final Shell parent) {
                    return new DefaultInformationControl(parent, true);
                }
            };
        }

        @Override
        public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
            return new DefaultAnnotationHover();
        }
    };
    javaSourceViewer.configure(javaSourceViewerConfiguration);
    javaSourceViewer.setEditable(false);
    javaSourceViewer.showAnnotations(true);
    sourceViewerDecorationSupport = new SourceViewerDecorationSupport(javaSourceViewer, overviewRuler, defaultMarkerAnnotationAccess, getSharedTextColors());
    for (AnnotationPreference annotationPreference : annotationPreferences) {
        sourceViewerDecorationSupport.setAnnotationPreference(annotationPreference);
    }
    sourceViewerDecorationSupport.install(preferenceStoreAccess.getPreferenceStore());
    return javaSourceViewer;
}
Also used : LineNumberRulerColumn(org.eclipse.jface.text.source.LineNumberRulerColumn) SimpleJavaSourceViewerConfiguration(org.eclipse.jdt.internal.ui.text.SimpleJavaSourceViewerConfiguration) DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) CompositeRuler(org.eclipse.jface.text.source.CompositeRuler) SourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport) IAnnotationHover(org.eclipse.jface.text.source.IAnnotationHover) IOverviewRuler(org.eclipse.jface.text.source.IOverviewRuler) IInformationControlCreator(org.eclipse.jface.text.IInformationControlCreator) AnnotationRulerColumn(org.eclipse.jface.text.source.AnnotationRulerColumn) Shell(org.eclipse.swt.widgets.Shell) IInformationControl(org.eclipse.jface.text.IInformationControl) JavaSourceViewer(org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer) OverviewRuler(org.eclipse.jface.text.source.OverviewRuler) IOverviewRuler(org.eclipse.jface.text.source.IOverviewRuler) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) DefaultAnnotationHover(org.eclipse.jface.text.source.DefaultAnnotationHover)

Aggregations

IInformationControlCreator (org.eclipse.jface.text.IInformationControlCreator)28 Shell (org.eclipse.swt.widgets.Shell)16 DefaultInformationControl (org.eclipse.jface.text.DefaultInformationControl)14 IInformationControl (org.eclipse.jface.text.IInformationControl)11 InformationPresenter (org.eclipse.jface.text.information.InformationPresenter)7 IContentAssistProcessor (org.eclipse.jface.text.contentassist.IContentAssistProcessor)5 IInformationPresenter (org.eclipse.jface.text.information.IInformationPresenter)5 SubjectControlContentAssistant (org.eclipse.jface.contentassist.SubjectControlContentAssistant)4 IInformationProvider (org.eclipse.jface.text.information.IInformationProvider)4 Point (org.eclipse.swt.graphics.Point)4 RegExContentAssistProcessor (net.sf.eclipsecs.ui.util.regex.RegExContentAssistProcessor)2 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)2 ProjectionSupport (org.eclipse.jface.text.source.projection.ProjectionSupport)2 HtmlTextPresenter (org.eclipse.mylyn.wikitext.ui.viewer.HtmlTextPresenter)2 Control (org.eclipse.swt.widgets.Control)2 HTMLTextPresenter (org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter)2 ContentAssistant (com.cubrid.common.ui.query.control.jface.text.contentassist.ContentAssistant)1 IContentAssistant (com.cubrid.common.ui.query.control.jface.text.contentassist.IContentAssistant)1 GroovyASTCompletionProcessor (eu.esdihumboldt.hale.ui.util.groovy.internal.contentassist.GroovyASTCompletionProcessor)1 PropertiesContentAssistProcessor (net.sf.eclipsecs.ui.config.PropertiesContentAssistProcessor)1