eclipse plugin: Update the renamed classes to use interfaces instead
This commit is contained in:
parent
8e81665f3b
commit
76134565a8
14 changed files with 56 additions and 102 deletions
|
@ -10,10 +10,9 @@ package org.wesnoth.ui;
|
|||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.parsetree.AbstractNode;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.impl.CompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
|
||||
|
||||
public class WMLUtil
|
||||
|
@ -21,9 +20,9 @@ public class WMLUtil
|
|||
public static String debug(EObject root)
|
||||
{
|
||||
CompositeNode node = NodeUtil.getNode(root);
|
||||
Iterable<AbstractNode> contents = NodeUtil.getAllContents(node);
|
||||
Iterable<INode> contents = NodeUtil.getAllContents(node);
|
||||
StringBuffer text = new StringBuffer();
|
||||
for (AbstractNode abstractNode : contents)
|
||||
for (INode abstractNode : contents)
|
||||
{
|
||||
if (abstractNode instanceof LeafNode)
|
||||
{
|
||||
|
|
|
@ -13,11 +13,11 @@ import org.eclipse.jface.text.BadLocationException;
|
|||
import org.eclipse.jface.text.DocumentCommand;
|
||||
import org.eclipse.jface.text.IAutoEditStrategy;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.parsetree.AbstractNode;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.ui.editor.XtextEditor;
|
||||
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
|
||||
|
@ -45,11 +45,11 @@ public class ClosingEndTagAutoEditStrategy implements IAutoEditStrategy
|
|||
IParseResult parseResult = state.getParseResult();
|
||||
if(parseResult == null)
|
||||
return;
|
||||
CompositeNode rootNode = parseResult.getRootNode();
|
||||
LeafNode node = (LeafNode) NodeUtil.findLeafNodeAtOffset(rootNode, command.offset);
|
||||
ICompositeNode rootNode = parseResult.getRootNode();
|
||||
ILeafNode node = (LeafNode) NodeUtil.findLeafNodeAtOffset(rootNode, command.offset);
|
||||
|
||||
String tagName = ""; //$NON-NLS-1$
|
||||
EList<AbstractNode> children = node.getParent().getParent().getChildren();
|
||||
EList<INode> children = node.getParent().getParent().getChildren();
|
||||
for(int i = 0 ;i < children.size(); ++i)
|
||||
{
|
||||
if ((children.get(i) instanceof LeafNode) == false)
|
||||
|
|
|
@ -18,9 +18,8 @@ import org.eclipse.jface.viewers.StyledString;
|
|||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.xtext.Assignment;
|
||||
import org.eclipse.xtext.RuleCall;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
|
||||
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
|
||||
import org.wesnoth.installs.WesnothInstallsUtils;
|
||||
|
@ -279,7 +278,7 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
|||
|
||||
if (parentTag != null)
|
||||
{
|
||||
CompositeNode node = NodeUtil.getNode(model);
|
||||
ICompositeNode node = NodeUtil.getNode(model);
|
||||
|
||||
String parentIndent = ""; //$NON-NLS-1$
|
||||
if (context.getCurrentNode().getOffset() > 0)
|
||||
|
|
|
@ -49,16 +49,16 @@ import org.eclipse.ui.PlatformUI;
|
|||
import org.eclipse.ui.ide.FileStoreEditorInput;
|
||||
import org.eclipse.ui.part.FileEditorInput;
|
||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.ui.editor.XtextEditor;
|
||||
import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingHelper;
|
||||
import org.wesnoth.WesnothPlugin;
|
||||
import org.wesnoth.Logger;
|
||||
import org.wesnoth.WesnothPlugin;
|
||||
import org.wesnoth.ui.Messages;
|
||||
import org.wesnoth.ui.WMLUiModule;
|
||||
import org.wesnoth.ui.syntax.WMLHighlightingHelper;
|
||||
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class WMLEditor extends XtextEditor
|
||||
|
@ -67,7 +67,7 @@ public class WMLEditor extends XtextEditor
|
|||
protected static final String ENCODING_UTF8 = "utf-8"; //$NON-NLS-1$
|
||||
|
||||
protected IHighlightingHelper highlightingHelper_;
|
||||
protected LeafNode currentHighlightedNode_;
|
||||
protected ILeafNode currentHighlightedNode_;
|
||||
|
||||
@Inject
|
||||
private IExtXtextEditorCustomizer editorCustomizer;
|
||||
|
@ -107,7 +107,7 @@ public class WMLEditor extends XtextEditor
|
|||
highlightingHelper_ = helper;
|
||||
}
|
||||
|
||||
public LeafNode getCurrentHighlightedNode()
|
||||
public ILeafNode getCurrentHighlightedNode()
|
||||
{
|
||||
return currentHighlightedNode_;
|
||||
}
|
||||
|
|
|
@ -13,9 +13,8 @@ import java.util.List;
|
|||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.ui.editor.folding.DefaultFoldingRegionProvider;
|
||||
import org.eclipse.xtext.ui.editor.folding.IFoldingRegion;
|
||||
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
|
||||
import org.wesnoth.wml.WMLKey;
|
||||
import org.wesnoth.wml.WMLTextdomain;
|
||||
|
@ -30,7 +29,7 @@ public class WMLFoldingRegionProvider extends DefaultFoldingRegionProvider
|
|||
}
|
||||
@Override
|
||||
protected Position getPosition(IXtextDocument xtextDocument,
|
||||
CompositeNode compositeNode)
|
||||
ICompositeNode compositeNode)
|
||||
{
|
||||
Assert.isNotNull(compositeNode, "parameter 'compositeNode' must not be null"); //$NON-NLS-1$
|
||||
if (compositeNode.getElement() instanceof WMLKey &&
|
||||
|
|
|
@ -13,10 +13,9 @@ import org.eclipse.core.commands.ExecutionEvent;
|
|||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.impl.CompositeNode;
|
||||
import org.eclipse.xtext.parser.IParseResult;
|
||||
import org.eclipse.xtext.parsetree.AbstractNode;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.ParseTreeUtil;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.ui.editor.XtextEditor;
|
||||
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
|
||||
|
@ -54,7 +53,7 @@ public class WMLDocHandler extends AbstractHandler
|
|||
positionAbsolute.y +=20;
|
||||
|
||||
IParseResult parseResult = resource.getParseResult();
|
||||
AbstractNode abstractNode = ParseTreeUtil.getCurrentOrPrecedingNodeByOffset(parseResult.getRootNode(), selection.getOffset());
|
||||
INode abstractNode = ParseTreeUtil.getCurrentOrPrecedingNodeByOffset(parseResult.getRootNode(), selection.getOffset());
|
||||
if (abstractNode == null || abstractNode.eContainer() == null)
|
||||
return;
|
||||
|
||||
|
|
|
@ -11,9 +11,8 @@ package org.wesnoth.ui.navigation;
|
|||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.jface.text.Region;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkHelper;
|
||||
import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkAcceptor;
|
||||
|
@ -36,7 +35,7 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
|||
IHyperlinkAcceptor acceptor)
|
||||
{
|
||||
super.createHyperlinksByOffset(resource, offset, acceptor);
|
||||
CompositeNode rootNode = NodeUtil.getRootNode(resource.getContents().get(0));
|
||||
ICompositeNode rootNode = NodeUtil.getRootNode(resource.getContents().get(0));
|
||||
if (rootNode == null)
|
||||
return;
|
||||
|
||||
|
@ -72,10 +71,10 @@ public class WMLHyperlinkHelper extends HyperlinkHelper
|
|||
IHyperlinkAcceptor acceptor, XtextResource resource)
|
||||
{
|
||||
if (node.eContainer() == null ||
|
||||
(node.eContainer() instanceof CompositeNode) == false)
|
||||
(node.eContainer() instanceof ICompositeNode) == false)
|
||||
return;
|
||||
|
||||
CompositeNode container = (CompositeNode)node.eContainer();
|
||||
ICompositeNode container = (ICompositeNode)node.eContainer();
|
||||
if ((container.getElement() instanceof WMLMacroCall) == false)
|
||||
return;
|
||||
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.wesnoth.ui.outline;
|
||||
|
||||
import org.eclipse.xtext.ui.editor.outline.actions.DefaultContentOutlineNodeAdapterFactory;
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public class WMLOutlineNodeAdapterFactory extends DefaultContentOutlineNodeAdapterFactory {
|
||||
|
||||
private static final Class<?>[] types = {
|
||||
// provide list of classes to adapt to, e.g.:
|
||||
// Entity.class
|
||||
// Service.class
|
||||
};
|
||||
|
||||
@Override
|
||||
public Class<?>[] getAdapterList() {
|
||||
return types;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* generated by Xtext
|
||||
*/
|
||||
package org.wesnoth.ui.outline;
|
||||
|
||||
import org.eclipse.xtext.ui.editor.outline.transformer.AbstractDeclarativeSemanticModelTransformer;
|
||||
|
||||
/**
|
||||
* customization of the default outline structure
|
||||
*
|
||||
*/
|
||||
public class WMLTransformer extends AbstractDeclarativeSemanticModelTransformer {
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
*******************************************************************************/
|
||||
package org.wesnoth.ui.syntax;
|
||||
|
||||
import org.eclipse.xtext.ui.editor.syntaxcoloring.antlr.DefaultAntlrTokenToAttributeIdMapper;
|
||||
import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper;
|
||||
|
||||
public class WMLAntlrTokenToAttributeIdMapper extends DefaultAntlrTokenToAttributeIdMapper
|
||||
{
|
||||
|
|
|
@ -12,11 +12,11 @@ import java.util.Iterator;
|
|||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.xtext.parsetree.AbstractNode;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeAdapter;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.impl.AbstractNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.CompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor;
|
||||
import org.eclipse.xtext.xtext.ui.editor.syntaxcoloring.SemanticHighlightingCalculator;
|
||||
|
@ -48,7 +48,7 @@ public class WMLSemanticHighlightingCalculator extends SemanticHighlightingCalcu
|
|||
if (skipNode(acceptor, current))
|
||||
continue;
|
||||
|
||||
AbstractNode begin=null, end=null;
|
||||
INode begin=null, end=null;
|
||||
String beginId = null, endId = null;
|
||||
if (current instanceof WMLTag)
|
||||
{
|
||||
|
@ -124,13 +124,13 @@ public class WMLSemanticHighlightingCalculator extends SemanticHighlightingCalcu
|
|||
if (node == null || id == null)
|
||||
return;
|
||||
|
||||
if (node instanceof LeafNode)
|
||||
if (node instanceof ILeafNode)
|
||||
{
|
||||
acceptor.addPosition(node.getOffset(), node.getLength(), id);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (LeafNode leaf : node.getLeafNodes())
|
||||
for (ILeafNode leaf : node.getLeafNodes())
|
||||
{
|
||||
if (!leaf.isHidden())
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ public class WMLSemanticHighlightingCalculator extends SemanticHighlightingCalcu
|
|||
}
|
||||
|
||||
@Override
|
||||
public AbstractNode getFirstFeatureNode(EObject semantic, String feature)
|
||||
public INode getFirstFeatureNode(EObject semantic, String feature)
|
||||
{
|
||||
NodeAdapter adapter = NodeUtil.getNodeAdapter(semantic);
|
||||
if (adapter != null)
|
||||
|
@ -149,7 +149,7 @@ public class WMLSemanticHighlightingCalculator extends SemanticHighlightingCalcu
|
|||
CompositeNode node = adapter.getParserNode();
|
||||
if (node != null)
|
||||
{
|
||||
for (AbstractNode child : node.getChildren())
|
||||
for (INode child : node.getChildren())
|
||||
{
|
||||
if (child instanceof LeafNode)
|
||||
{
|
||||
|
|
|
@ -14,12 +14,10 @@ import org.eclipse.jface.text.IRegion;
|
|||
import org.eclipse.jface.text.Region;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.Keyword;
|
||||
import org.eclipse.xtext.parsetree.AbstractNode;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.impl.CompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.ui.editor.bracketmatching.DefaultBracketMatcher;
|
||||
import org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler;
|
||||
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
|
||||
import org.eclipse.xtext.util.Pair;
|
||||
|
@ -54,7 +52,7 @@ public class WMLBracketMatching extends DefaultBracketMatcher
|
|||
CompositeNode rootNode = NodeUtil.getRootNode(state.getContents().get(0));
|
||||
if (rootNode == null)
|
||||
return null;
|
||||
AbstractNode node = NodeUtil.findLeafNodeAtOffset(rootNode, offset);
|
||||
INode node = NodeUtil.findLeafNodeAtOffset(rootNode, offset);
|
||||
if (node == null)
|
||||
return null;
|
||||
|
||||
|
@ -68,7 +66,7 @@ public class WMLBracketMatching extends DefaultBracketMatcher
|
|||
}
|
||||
if (element != null)
|
||||
{
|
||||
AbstractNode correspondingNode = findMatchingNode(node, element, forwardSearch);
|
||||
INode correspondingNode = findMatchingNode(node, element, forwardSearch);
|
||||
if (correspondingNode != null)
|
||||
{
|
||||
return new Region(correspondingNode.getOffset(), correspondingNode.getLength());
|
||||
|
@ -145,7 +143,7 @@ public class WMLBracketMatching extends DefaultBracketMatcher
|
|||
public LeafNode findWMLLeafNodeAtOffset(CompositeNode parseTreeRootNode, int offset, boolean findClosed)
|
||||
{
|
||||
boolean isClosed = false;
|
||||
for (AbstractNode node : parseTreeRootNode.getChildren())
|
||||
for (INode node : parseTreeRootNode.getChildren())
|
||||
{
|
||||
if (node.getTotalOffset() <= offset)
|
||||
{
|
||||
|
@ -166,7 +164,7 @@ public class WMLBracketMatching extends DefaultBracketMatcher
|
|||
return null;
|
||||
}
|
||||
|
||||
private boolean isWMLTag(AbstractNode node)
|
||||
private boolean isWMLTag(INode node)
|
||||
{
|
||||
return (node.eContainer() != null &&
|
||||
node.eContainer() instanceof CompositeNode && ((CompositeNode) node.eContainer()).getElement() instanceof WMLTag);
|
||||
|
|
|
@ -12,10 +12,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.xtext.parsetree.AbstractNode;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.nodemodel.ILeafNode;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.impl.CompositeNode;
|
||||
import org.wesnoth.wml.WMLExpression;
|
||||
import org.wesnoth.wml.WMLKey;
|
||||
import org.wesnoth.wml.WMLKeyValue;
|
||||
|
@ -91,8 +90,8 @@ public class WMLGrammarUtils
|
|||
|
||||
StringBuilder result = new StringBuilder( );
|
||||
|
||||
for ( AbstractNode tmpNode : node.getChildren( ) ) {
|
||||
for ( LeafNode leafNode : tmpNode.getLeafNodes( ) ) {
|
||||
for ( INode tmpNode : node.getChildren( ) ) {
|
||||
for ( ILeafNode leafNode : tmpNode.getLeafNodes( ) ) {
|
||||
if ( leafNode.getLength( ) == 0 )
|
||||
continue;
|
||||
|
||||
|
|
|
@ -12,9 +12,8 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtext.parsetree.CompositeNode;
|
||||
import org.eclipse.xtext.parsetree.LeafNode;
|
||||
import org.eclipse.xtext.parsetree.NodeUtil;
|
||||
import org.eclipse.xtext.nodemodel.ICompositeNode;
|
||||
import org.eclipse.xtext.nodemodel.impl.LeafNode;
|
||||
import org.eclipse.xtext.validation.Check;
|
||||
import org.eclipse.xtext.validation.CheckType;
|
||||
import org.wesnoth.Messages;
|
||||
|
@ -48,7 +47,7 @@ public class WMLJavaValidator extends AbstractWMLJavaValidator
|
|||
// @Check(CheckType.NORMAL)
|
||||
public void checkNormalTagName(WMLTag tag)
|
||||
{
|
||||
CompositeNode node = NodeUtil.getNodeAdapter(tag).getParserNode();
|
||||
ICompositeNode node = NodeUtil.getNodeAdapter(tag).getParserNode();
|
||||
if (node != null)
|
||||
{
|
||||
LeafNode parentNode = (LeafNode)
|
||||
|
|
Loading…
Add table
Reference in a new issue