Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0b3b29f61b39c23e7d79f507e15e3221726b6d82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
 * Copyright (c) 2015 protos software gmbh (http://www.protos.de).
 * 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:
 * 		Juergen Haug (initial contribution)
 */
package org.eclipse.etrice.ui.behavior.actioneditor.sourceviewer;

import com.google.common.base.Objects;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.xtend.lib.annotations.Delegate;
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;

@FinalFieldsConstructor
@SuppressWarnings("all")
public class CustomCompletionProposal implements ICompletionProposal {
  @Delegate
  private final ICompletionProposal delegate;
  
  private final Point selection;
  
  @Override
  public Point getSelection(final IDocument document) {
    Point _xifexpression = null;
    boolean _notEquals = (!Objects.equal(this.selection, null));
    if (_notEquals) {
      _xifexpression = this.selection;
    } else {
      _xifexpression = this.delegate.getSelection(document);
    }
    return _xifexpression;
  }
  
  public CustomCompletionProposal(final ICompletionProposal delegate, final Point selection) {
    super();
    this.delegate = delegate;
    this.selection = selection;
  }
  
  public void apply(final IDocument document) {
    this.delegate.apply(document);
  }
  
  public String getAdditionalProposalInfo() {
    return this.delegate.getAdditionalProposalInfo();
  }
  
  public IContextInformation getContextInformation() {
    return this.delegate.getContextInformation();
  }
  
  public String getDisplayString() {
    return this.delegate.getDisplayString();
  }
  
  public Image getImage() {
    return this.delegate.getImage();
  }
}

Back to the top