FileDocCategorySizeDatePackage
AndroidSourceViewerConfig.javaAPI DocAndroid 1.5 API4387Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors

AndroidSourceViewerConfig

public class AndroidSourceViewerConfig extends org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML
Base Source Viewer Configuration for Android resources.

Fields Summary
private org.eclipse.jface.text.contentassist.IContentAssistProcessor
mProcessor
Content Assist Processor to use for all handled partitions.
Constructors Summary
public AndroidSourceViewerConfig(org.eclipse.jface.text.contentassist.IContentAssistProcessor processor)

        super();
        mProcessor = processor;
    
Methods Summary
public org.eclipse.jface.text.IAutoEditStrategy[]getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)

        // TODO auto edit strategies for android xml
        return super.getAutoEditStrategies(sourceViewer, contentType);
    
protected org.eclipse.jface.text.contentassist.IContentAssistProcessor[]getContentAssistProcessors(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String partitionType)
Returns the content assist processors that will be used for content assist in the given source viewer and for the given partition type.

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

        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;
        }
    
public org.eclipse.jface.text.contentassist.IContentAssistantgetContentAssistant(org.eclipse.jface.text.source.ISourceViewer sourceViewer)

        return super.getContentAssistant(sourceViewer);
    
public org.eclipse.jface.text.formatter.IContentFormattergetContentFormatter(org.eclipse.jface.text.source.ISourceViewer sourceViewer)

        // TODO content formatter for android xml
        return super.getContentFormatter(sourceViewer);
    
public org.eclipse.jface.text.ITextHovergetTextHover(org.eclipse.jface.text.source.ISourceViewer sourceViewer, java.lang.String contentType)

        // TODO text hover for android xml
        return super.getTextHover(sourceViewer, contentType);