-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from LorenzoBettini/task_217-Outline_should_h…
…ighlight_modified_elements Task 217 outline should highlight modified elements
- Loading branch information
Showing
8 changed files
with
146 additions
and
129 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
edelta.parent/edelta.ui/src/edelta/ui/labeling/EdeltaDescriptionLabelProvider.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,15 @@ | ||
/* | ||
* generated by Xtext 2.22.0 | ||
*/ | ||
package edelta.ui.labeling; | ||
|
||
import org.eclipse.xtext.xbase.ui.labeling.XbaseDescriptionLabelProvider; | ||
|
||
/** | ||
* Provides labels for IEObjectDescriptions and IResourceDescriptions. | ||
* | ||
* See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#label-provider | ||
*/ | ||
public class EdeltaDescriptionLabelProvider extends XbaseDescriptionLabelProvider { | ||
|
||
} |
24 changes: 0 additions & 24 deletions
24
edelta.parent/edelta.ui/src/edelta/ui/labeling/EdeltaDescriptionLabelProvider.xtend
This file was deleted.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
edelta.parent/edelta.ui/src/edelta/ui/labeling/EdeltaLabelProvider.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,66 @@ | ||
/** | ||
* generated by Xtext 2.10.0 | ||
*/ | ||
package edelta.ui.labeling; | ||
|
||
import static com.google.common.collect.Iterables.filter; | ||
import static org.eclipse.xtext.xbase.lib.IterableExtensions.head; | ||
|
||
import org.eclipse.emf.ecore.ENamedElement; | ||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; | ||
import org.eclipse.jface.resource.ImageDescriptor; | ||
import org.eclipse.xtext.common.types.JvmOperation; | ||
import org.eclipse.xtext.xbase.annotations.ui.labeling.XbaseWithAnnotationsLabelProvider; | ||
import org.eclipse.xtext.xbase.jvmmodel.IJvmModelAssociations; | ||
|
||
import com.google.inject.Inject; | ||
|
||
import edelta.edelta.EdeltaModifyEcoreOperation; | ||
import edelta.edelta.EdeltaOperation; | ||
|
||
/** | ||
* Provides labels for EObjects. | ||
* | ||
* See | ||
* https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider | ||
*/ | ||
public class EdeltaLabelProvider extends XbaseWithAnnotationsLabelProvider { | ||
@Inject | ||
private IJvmModelAssociations jvmModelAssociations; | ||
|
||
private AdapterFactoryLabelProvider delegate; | ||
|
||
@Inject | ||
public EdeltaLabelProvider(final AdapterFactoryLabelProvider delegate) { | ||
super(delegate); | ||
this.delegate = delegate; | ||
} | ||
|
||
public Object text(final EdeltaOperation m) { | ||
return this.text(this.inferredJavaMethod(m)); | ||
} | ||
|
||
public ImageDescriptor image(final EdeltaOperation m) { | ||
return this.imageDescriptor(this.inferredJavaMethod(m)); | ||
} | ||
|
||
public Object text(final EdeltaModifyEcoreOperation m) { | ||
return this.text(this.inferredJavaMethod(m)); | ||
} | ||
|
||
public ImageDescriptor image(final EdeltaModifyEcoreOperation m) { | ||
return this.imageDescriptor(this.inferredJavaMethod(m)); | ||
} | ||
|
||
public String text(final ENamedElement e) { | ||
// delegate to the default Ecore edit label provider | ||
// for Ecore model elements. | ||
return delegate.getText(e); | ||
} | ||
|
||
private JvmOperation inferredJavaMethod(final EObject e) { | ||
return head(filter( | ||
jvmModelAssociations.getJvmElements(e), JvmOperation.class)); | ||
} | ||
} |
58 changes: 0 additions & 58 deletions
58
edelta.parent/edelta.ui/src/edelta/ui/labeling/EdeltaLabelProvider.xtend
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
edelta.parent/edelta.ui/src/edelta/ui/outline/EdeltaOutlineTreeProvider.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,48 @@ | ||
/** | ||
* generated by Xtext 2.10.0 | ||
*/ | ||
package edelta.ui.outline; | ||
|
||
import org.eclipse.emf.ecore.EPackage; | ||
import org.eclipse.xtext.ui.editor.outline.IOutlineNode; | ||
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; | ||
|
||
import com.google.inject.Inject; | ||
|
||
import edelta.edelta.EdeltaModifyEcoreOperation; | ||
import edelta.edelta.EdeltaOperation; | ||
import edelta.edelta.EdeltaProgram; | ||
import edelta.resource.derivedstate.EdeltaDerivedStateHelper; | ||
|
||
/** | ||
* Customization of the default outline structure. | ||
* | ||
* See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#outline | ||
*/ | ||
public class EdeltaOutlineTreeProvider extends DefaultOutlineTreeProvider { | ||
@Inject | ||
private EdeltaDerivedStateHelper derivedStateHelper; | ||
|
||
protected void _createChildren(final IOutlineNode parentNode, final EdeltaProgram p) { | ||
for (final EdeltaOperation o : p.getOperations()) { | ||
this.createNode(parentNode, o); | ||
} | ||
for (final EdeltaModifyEcoreOperation o : p.getModifyEcoreOperations()) { | ||
this.createNode(parentNode, o); | ||
} | ||
for (final EPackage copiedEPackage : this.derivedStateHelper.getCopiedEPackagesMap(p.eResource()).values()) { | ||
// the cool thing is that we don't need to provide | ||
// customization in the label provider for EPackage and EClass | ||
// since Xtext defaults to the .edit plugin :) | ||
this.createNode(parentNode, copiedEPackage); | ||
} | ||
} | ||
|
||
public boolean _isLeaf(final EdeltaOperation m) { | ||
return true; | ||
} | ||
|
||
public boolean _isLeaf(final EdeltaModifyEcoreOperation m) { | ||
return true; | ||
} | ||
} |
46 changes: 0 additions & 46 deletions
46
edelta.parent/edelta.ui/src/edelta/ui/outline/EdeltaOutlineTreeProvider.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
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