// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/EditorConfigImages.java
// public class EditorConfigImages {
// 
// 	private static final String ICONS_PATH = "$nl$/icons/full/"; //$NON-NLS-1$
// 	private static final String OBJECT = ICONS_PATH + "obj16/"; // basic colors - size 16x16 //$NON-NLS-1$
// 	
// 	public static final String IMG_PROPERTY = "IMG_PROPERTY"; //$NON-NLS-1$
// 	public static final String IMG_VALUE = "IMG_VALUE"; //$NON-NLS-1$
// 	
// 	private EditorConfigImages() {
// 	}
// 
// 	private static ImageRegistry imageRegistry;
// 
// 	public static void initalize(ImageRegistry registry) {
// 		imageRegistry = registry;
// 
// 		declareRegistryImage(IMG_PROPERTY, OBJECT + "property.png"); //$NON-NLS-1$
// 		declareRegistryImage(IMG_VALUE, OBJECT + "value.png"); //$NON-NLS-1$
// 	}
// 
// 	private final static void declareRegistryImage(String key, String path) {
// 		ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
// 		Bundle bundle = Platform.getBundle(EditorConfigPlugin.PLUGIN_ID);
// 		URL url = null;
// 		if (bundle != null) {
// 			url = FileLocator.find(bundle, new Path(path), null);
// 			if (url != null) {
// 				desc = ImageDescriptor.createFromURL(url);
// 			}
// 		}
// 		imageRegistry.put(key, desc);
// 	}
// 
// 	/**
// 	 * Returns the <code>Image</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static Image getImage(String key) {
// 		return getImageRegistry().get(key);
// 	}
// 
// 	/**
// 	 * Returns the <code>ImageDescriptor</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static ImageDescriptor getImageDescriptor(String key) {
// 		return getImageRegistry().getDescriptor(key);
// 	}
// 
// 	public static ImageRegistry getImageRegistry() {
// 		if (imageRegistry == null) {
// 			imageRegistry = EditorConfigPlugin.getDefault().getImageRegistry();
// 		}
// 		return imageRegistry;
// 	}
// 
// }


import org.ec4j.core.ide.TokenContext.TokenContextType;
import org.ec4j.core.ide.completion.CompletionEntry;
import org.ec4j.core.model.PropertyType;
import org.eclipse.ec4e.internal.EditorConfigImages;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.contentassist.BoldStylerProvider;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension7;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.link.ILinkedModeListener;
import org.eclipse.jface.text.link.InclusivePositionUpdater;
import org.eclipse.jface.text.link.LinkedModeModel;
import org.eclipse.jface.text.link.LinkedModeUI;
import org.eclipse.jface.text.link.LinkedModeUI.ExitFlags;
import org.eclipse.jface.text.link.LinkedModeUI.IExitPolicy;
import org.eclipse.jface.text.link.LinkedPositionGroup;
import org.eclipse.jface.text.link.ProposalPosition;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.texteditor.link.EditorLinkedModeUI;

	private boolean insertCompletion() {
		return true;
	}

	@Override
	public Point getSelection(IDocument document) {
		initIfNeeded();
		if (fSelectedRegion == null) {
			return new Point(getReplacementOffset(), 0);
		}
		return new Point(fSelectedRegion.getOffset(), fSelectedRegion.getLength());
	}

	@Override
	public String getAdditionalProposalInfo() {
		initIfNeeded();
		PropertyType<?> optionType = completionEntry.getPropertyType();
		return optionType != null ? optionType.getDescription() : null;
	}

	@Override
	public String getDisplayString() {
		initIfNeeded();
		return completionEntry.getName();
	}

	@Override
	public Image getImage() {
		switch (completionEntry.getContextType()) {
		case PROPERTY_NAME:

// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/EditorConfigImages.java
// public class EditorConfigImages {
// 
// 	private static final String ICONS_PATH = "$nl$/icons/full/"; //$NON-NLS-1$
// 	private static final String OBJECT = ICONS_PATH + "obj16/"; // basic colors - size 16x16 //$NON-NLS-1$
// 	
// 	public static final String IMG_PROPERTY = "IMG_PROPERTY"; //$NON-NLS-1$
// 	public static final String IMG_VALUE = "IMG_VALUE"; //$NON-NLS-1$
// 	
// 	private EditorConfigImages() {
// 	}
// 
// 	private static ImageRegistry imageRegistry;
// 
// 	public static void initalize(ImageRegistry registry) {
// 		imageRegistry = registry;
// 
// 		declareRegistryImage(IMG_PROPERTY, OBJECT + "property.png"); //$NON-NLS-1$
// 		declareRegistryImage(IMG_VALUE, OBJECT + "value.png"); //$NON-NLS-1$
// 	}
// 
// 	private final static void declareRegistryImage(String key, String path) {
// 		ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
// 		Bundle bundle = Platform.getBundle(EditorConfigPlugin.PLUGIN_ID);
// 		URL url = null;
// 		if (bundle != null) {
// 			url = FileLocator.find(bundle, new Path(path), null);
// 			if (url != null) {
// 				desc = ImageDescriptor.createFromURL(url);
// 			}
// 		}
// 		imageRegistry.put(key, desc);
// 	}
// 
// 	/**
// 	 * Returns the <code>Image</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static Image getImage(String key) {
// 		return getImageRegistry().get(key);
// 	}
// 
// 	/**
// 	 * Returns the <code>ImageDescriptor</code> identified by the given key, or
// 	 * <code>null</code> if it does not exist.
// 	 */
// 	public static ImageDescriptor getImageDescriptor(String key) {
// 		return getImageRegistry().getDescriptor(key);
// 	}
// 
// 	public static ImageRegistry getImageRegistry() {
// 		if (imageRegistry == null) {
// 			imageRegistry = EditorConfigPlugin.getDefault().getImageRegistry();
// 		}
// 		return imageRegistry;
// 	}
// 
// }


// Path: org.eclipse.ec4e/src/main/java/org/eclipse/ec4e/internal/completion/EditorConfigCompletionProposal.java
import org.ec4j.core.ide.TokenContext.TokenContextType;
import org.ec4j.core.ide.completion.CompletionEntry;
import org.ec4j.core.model.PropertyType;
import org.eclipse.ec4e.internal.EditorConfigImages;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.contentassist.BoldStylerProvider;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension7;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.link.ILinkedModeListener;
import org.eclipse.jface.text.link.InclusivePositionUpdater;
import org.eclipse.jface.text.link.LinkedModeModel;
import org.eclipse.jface.text.link.LinkedModeUI;
import org.eclipse.jface.text.link.LinkedModeUI.ExitFlags;
import org.eclipse.jface.text.link.LinkedModeUI.IExitPolicy;
import org.eclipse.jface.text.link.LinkedPositionGroup;
import org.eclipse.jface.text.link.ProposalPosition;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.texteditor.link.EditorLinkedModeUI;

	private boolean insertCompletion() {
		return true;
	}

	@Override
	public Point getSelection(IDocument document) {
		initIfNeeded();
		if (fSelectedRegion == null) {
			return new Point(getReplacementOffset(), 0);
		}
		return new Point(fSelectedRegion.getOffset(), fSelectedRegion.getLength());
	}

	@Override
	public String getAdditionalProposalInfo() {
		initIfNeeded();
		PropertyType<?> optionType = completionEntry.getPropertyType();
		return optionType != null ? optionType.getDescription() : null;
	}

	@Override
	public String getDisplayString() {
		initIfNeeded();
		return completionEntry.getName();
	}

	@Override
	public Image getImage() {
		switch (completionEntry.getContextType()) {
		case PROPERTY_NAME:

			return EditorConfigImages.getImage(EditorConfigImages.IMG_PROPERTY);
