Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EmfParsleyDslOutlineTreeProvider in Java
- Loading branch information
1 parent
daab1bb
commit b2df290
Showing
3 changed files
with
64 additions
and
58 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...y.dsl.ui/src/org/eclipse/emf/parsley/dsl/ui/outline/EmfParsleyDslOutlineTreeProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) and others. | ||
* 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: | ||
* Lorenzo Bettini - initial API and implementation | ||
*/ | ||
package org.eclipse.emf.parsley.dsl.ui.outline; | ||
|
||
import static org.eclipse.xtext.xbase.lib.IterableExtensions.sortBy; | ||
|
||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.emf.parsley.dsl.model.BindingsSpecification; | ||
import org.eclipse.emf.parsley.dsl.model.Model; | ||
import org.eclipse.emf.parsley.dsl.model.PartsSpecifications; | ||
import org.eclipse.emf.parsley.dsl.model.WithExtendsClause; | ||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils; | ||
import org.eclipse.xtext.ui.editor.outline.IOutlineNode; | ||
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; | ||
import org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode; | ||
|
||
/** | ||
* Customization of the default outline structure. | ||
* | ||
* see http://www.eclipse.org/Xtext/documentation.html#outline | ||
*/ | ||
public class EmfParsleyDslOutlineTreeProvider extends DefaultOutlineTreeProvider { | ||
protected void _createChildren(DocumentRootNode parentNode, Model m) { // NOSONAR | ||
// skip useless toplevel node and imports - start tree main module element | ||
createChildren(parentNode, m.getModule()); | ||
} | ||
|
||
protected void _createChildren(IOutlineNode parentNode, org.eclipse.emf.parsley.dsl.model.Module m) { // NOSONAR | ||
// this way the nodes will appear in the same order as | ||
// specified in the program text | ||
var contentsOrderedByOffset = sortBy(m.eContents(), | ||
it -> Integer.valueOf(NodeModelUtils.getNode(it).getOffset())); | ||
for (EObject o : contentsOrderedByOffset) { | ||
createNode(parentNode, o); | ||
} | ||
} | ||
|
||
public boolean _isLeaf(org.eclipse.emf.parsley.dsl.model.Module m) { // NOSONAR | ||
return false; | ||
} | ||
|
||
public boolean _isLeaf(BindingsSpecification e) { // NOSONAR | ||
return true; | ||
} | ||
|
||
public boolean _isLeaf(PartsSpecifications e) { // NOSONAR | ||
return true; | ||
} | ||
|
||
public boolean _isLeaf(WithExtendsClause e) { // NOSONAR | ||
return true; | ||
} | ||
} |
58 changes: 0 additions & 58 deletions
58
....dsl.ui/src/org/eclipse/emf/parsley/dsl/ui/outline/EmfParsleyDslOutlineTreeProvider.xtend
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,9 @@ Workflow { | |
labelProvider = { | ||
generateXtendStub = false | ||
} | ||
outline = { | ||
generateXtendStub = false | ||
} | ||
} | ||
} | ||
} |