Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 976e8f8167f405644124d929523175a78444f54f (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
/*****************************************************************************
 * Copyright (c) 2013, 2014 CEA LIST.
 *
 *    
 * 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:
 *  IJI - Initial implementation
 * 
 *****************************************************************************/

package org.eclipse.papyrus.uml.alf.ui.outline

import org.eclipse.papyrus.uml.alf.Member;
import org.eclipse.papyrus.uml.alf.QualifiedName

/**
 * Customization of the default outline structure.
 *
 * see http://www.eclipse.org/Xtext/documentation.html#outline
 */
class AlfOutlineTreeProvider extends org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider {
  
  private static final String SUFFIX = "Impl"
  
  protected override Object _text(Object modelElement) {
    var text = modelElement.class.simpleName
    val l = text.length
    if (l > SUFFIX.length && text.endsWith(SUFFIX)) {
      text = text.substring(0, l - SUFFIX.length)
    }
    if (modelElement instanceof Member) {
      text = text + " " + (modelElement as Member).definition.name      
    } else if (modelElement instanceof QualifiedName) {
      text = text + " " + (modelElement as QualifiedName).pathName
    }
    return text
  }
  
}
	

Back to the top