/*******************************************************************************
* * Copyright (c) 2009, 2010 Innovation Gate GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.editors.tml;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension3;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import de.innovationgate.eclipse.editors.helpers.ContextInformation;
public class TMLCompletionProposal implements ICompletionProposal,ICompletionProposalExtension3, ICompletionProposalExtension5 {
private CompletionProposal _proposal;
private ContextInformation _contextInformation;
public void apply(IDocument document) {
_proposal.apply(document);
}
public boolean equals(Object obj) {
return _proposal.equals(obj);
}
public String getAdditionalProposalInfo() {
return null;
}
public IContextInformation getContextInformation() {
return _proposal.getContextInformation();
}
public String getDisplayString() {
return _proposal.getDisplayString();
}
public Image getImage() {
return _proposal.getImage();
}
public Point getSelection(IDocument document) {
return _proposal.getSelection(document);
}
public int hashCode() {
return _proposal.hashCode();
}
public String toString() {
return _proposal.toString();
}
public TMLCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, ContextInformation contextInformation) {
// String info = null;
// if (contextInformation != null) {
// info = contextInformation.getInformation();
// }
_proposal = new CompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, null, null);
_contextInformation = contextInformation;
}
public IInformationControlCreator getInformationControlCreator() {
return new HTMLInformationControlCreator();
}
public int getPrefixCompletionStart(IDocument document, int completionOffset) {
return 0;
}
public CharSequence getPrefixCompletionText(IDocument document,
int completionOffset) {
return null;
}
public Object getAdditionalProposalInfo(IProgressMonitor arg0) {
return _contextInformation;
}
}