eclipse plugin: Implement proper naming...
...for WMLRoot and XtextDocument elements
This commit is contained in:
parent
5c39513c85
commit
a986604c3c
2 changed files with 23 additions and 2 deletions
|
@ -13,6 +13,7 @@ import java.util.Locale;
|
|||
import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.xtext.ui.editor.model.XtextDocument;
|
||||
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
@ -25,6 +26,7 @@ import com.google.inject.Inject;
|
|||
public class WMLLabelProvider extends DefaultEObjectLabelProvider
|
||||
{
|
||||
private static WMLLabelProvider instance_;
|
||||
|
||||
@Inject
|
||||
public WMLLabelProvider(AdapterFactoryLabelProvider delegate) {
|
||||
super(delegate);
|
||||
|
@ -51,4 +53,14 @@ public class WMLLabelProvider extends DefaultEObjectLabelProvider
|
|||
return null;
|
||||
return instance_.getImage(fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText( Object element )
|
||||
{
|
||||
if ( element instanceof XtextDocument ) {
|
||||
return "Document";
|
||||
}
|
||||
|
||||
return super.getText( element );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,21 @@
|
|||
*/
|
||||
package org.wesnoth.ui.outline;
|
||||
|
||||
import org.wesnoth.wml.WMLRoot;
|
||||
|
||||
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
|
||||
|
||||
/**
|
||||
* customization of the default outline structure
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class WMLOutlineTreeProvider extends DefaultOutlineTreeProvider {
|
||||
|
||||
@Override
|
||||
protected Object _text( Object modelElement )
|
||||
{
|
||||
if ( modelElement instanceof WMLRoot ) {
|
||||
return "Root";
|
||||
}
|
||||
return super._text( modelElement );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue