Example usage for org.eclipse.jface.viewers IInputProvider getInput

List of usage examples for org.eclipse.jface.viewers IInputProvider getInput

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers IInputProvider getInput.

Prototype

public Object getInput();

Source Link

Document

Returns the input.

Usage

From source file:com.android.ide.eclipse.editors.AndroidSourceViewerConfig.java

License:Open Source License

/**
 * Returns the content assist processors that will be used for content
 * assist in the given source viewer and for the given partition type.
 * /*from w  w w .  j ava  2  s  .  c  o  m*/
 * @param sourceViewer the source viewer to be configured by this
 *        configuration
 * @param partitionType the partition type for which the content assist
 *        processors are applicable
 * @return IContentAssistProcessors or null if should not be supported
 */
@Override
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer,
        String partitionType) {
    ArrayList<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
    if (partitionType == IStructuredPartitions.UNKNOWN_PARTITION
            || partitionType == IStructuredPartitions.DEFAULT_PARTITION
            || partitionType == IXMLPartitions.XML_DEFAULT) {
        if (sourceViewer instanceof IInputProvider) {
            IInputProvider input = (IInputProvider) sourceViewer;
            Object a = input.getInput();
            if (a != null)
                a.toString();
        }

        IDocument doc = sourceViewer.getDocument();
        if (doc != null)
            doc.toString();

        processors.add(mProcessor);
    }

    IContentAssistProcessor[] others = super.getContentAssistProcessors(sourceViewer, partitionType);
    if (others != null && others.length > 0) {
        for (IContentAssistProcessor p : others) {
            processors.add(p);
        }
    }

    if (processors.size() > 0) {
        return processors.toArray(new IContentAssistProcessor[processors.size()]);
    } else {
        return null;
    }
}