diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.java similarity index 60% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.java index 73dd254f9..9df92b9be 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.java @@ -1,25 +1,23 @@ /******************************************************************************* - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.contentassist - -import org.eclipse.xtext.ide.editor.contentassist.ContentAssistEntry +package org.eclipse.xtext.ide.editor.contentassist; /** * @noreference */ -interface IIdeContentProposalAcceptor { +public interface IIdeContentProposalAcceptor { /** * Handle the given content assist entry. The entry may be {@code null}. */ - def void accept(ContentAssistEntry entry, int priority) + void accept(ContentAssistEntry entry, int priority); - def boolean canAcceptMoreProposals() + boolean canAcceptMoreProposals(); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java similarity index 54% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java index 6c097cad4..839cff909 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java @@ -1,36 +1,37 @@ /******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.contentassist +package org.eclipse.xtext.ide.editor.contentassist; -import com.google.inject.ImplementedBy +import com.google.inject.ImplementedBy; -/** - * Prefix matchers are used to reject content assist proposals that do not match the prefix at - * the current cursor position. +/** + * Prefix matchers are used to reject content assist proposals that do not match the prefix at the current cursor + * position. * * @since 2.10 * @noreference */ -@ImplementedBy(IPrefixMatcher.IgnoreCase) -interface IPrefixMatcher { - - def boolean isCandidateMatchingPrefix(String name, String prefix) - - /** +@ImplementedBy(IPrefixMatcher.IgnoreCase.class) +public interface IPrefixMatcher { + + boolean isCandidateMatchingPrefix(String name, String prefix); + + /** * Default prefix matcher that compares the prefix of the candidate ignoring case. */ static class IgnoreCase implements IPrefixMatcher { - - override boolean isCandidateMatchingPrefix(String name, String prefix) { - return name.regionMatches(true, 0, prefix, 0, prefix.length) + + @Override + public boolean isCandidateMatchingPrefix(String name, String prefix) { + return name.regionMatches(true, 0, prefix, 0, prefix.length()); } - + } - + } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.java similarity index 58% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.java index f7d9b61e8..eed5f6487 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.java @@ -1,12 +1,12 @@ /******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.hierarchy +package org.eclipse.xtext.ide.editor.hierarchy; /** * It is used to build a call hierarchy structure. @@ -14,15 +14,13 @@ package org.eclipse.xtext.ide.editor.hierarchy * @author kosyakov - Initial contribution and API * @since 2.10 */ -interface ICallHierarchyBuilder extends IHierarchyBuilder { +public interface ICallHierarchyBuilder extends IHierarchyBuilder { - static enum CallHierarchyType { - CALLER, - CALLEE + enum CallHierarchyType { + CALLER, CALLEE; } - def CallHierarchyType getHierarchyType(); - - def void setHierarchyType(CallHierarchyType hierarchyType); + ICallHierarchyBuilder.CallHierarchyType getHierarchyType(); + void setHierarchyType(ICallHierarchyBuilder.CallHierarchyType hierarchyType); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.java similarity index 63% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.java index fa7514fec..7a3a5dbdb 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.hierarchy +package org.eclipse.xtext.ide.editor.hierarchy; -import java.util.Collection -import org.eclipse.core.runtime.IProgressMonitor -import org.eclipse.emf.common.util.URI +import java.util.Collection; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.util.URI; /** * This class is used to build a hierarchy structure. @@ -18,16 +18,16 @@ import org.eclipse.emf.common.util.URI * @author kosyakov - Initial contribution and API * @since 2.10 */ -interface IHierarchyBuilder { +public interface IHierarchyBuilder { /** * @return root hierarchy nodes for the given URI; empty if the hierarchy cannot be built for the given URI */ - def Collection buildRoots(URI rootURI, IProgressMonitor monitor) + Collection buildRoots(URI rootURI, IProgressMonitor monitor); /** * @return child nodes for the given parent node; empty if {@link IHierarchyNode#mayHaveChildren} returns false for the parent */ - def Collection buildChildren(IHierarchyNode parent, IProgressMonitor monitor) + Collection buildChildren(IHierarchyNode parent, IProgressMonitor monitor); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.java similarity index 60% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.java index d1c76e5ec..b8dea9b53 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.java @@ -1,47 +1,47 @@ /******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.hierarchy +package org.eclipse.xtext.ide.editor.hierarchy; -import java.util.Collection -import org.eclipse.xtext.ide.editor.navigation.INavigatable -import org.eclipse.xtext.resource.IEObjectDescription +import java.util.Collection; + +import org.eclipse.xtext.ide.editor.navigation.INavigatable; +import org.eclipse.xtext.resource.IEObjectDescription; /** - * Represents a hierarchy node. + * Represents a hierarchy node. * * @author kosyakov - Initial contribution and API * @since 2.10 */ -interface IHierarchyNode extends INavigatable { - +public interface IHierarchyNode extends INavigatable { /** * @return an associated element that is used to build child nodes */ - def IEObjectDescription getElement() + IEObjectDescription getElement(); /** * @return a parent; null if the node is a root */ - def IHierarchyNode getParent() + IHierarchyNode getParent(); /** - * @return references used to reach the node from a parent; empty if the node is a root + * @return references used to reach the node from a parent; empty if the node is a root */ - def Collection getReferences() + Collection getReferences(); /** * @return whether there is a parent (can be transitive) containing the same element as the node */ - def boolean isRecursive() + boolean isRecursive(); /** - * @return whether the node may have children; e.g. a recursive node cannot have children + * @return whether the node may have children; e.g. a recursive node cannot have children */ - def boolean mayHaveChildren() + boolean mayHaveChildren(); } diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.java similarity index 64% rename from org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.java rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.java index 5c889148b..facde4d2f 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.java @@ -1,17 +1,16 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. +/******************************************************************************* + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. - * + * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.ide.editor.hierarchy; import com.google.inject.ImplementedBy; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.xtext.ide.editor.hierarchy.DefaultHierarchyNodeLocationProvider; import org.eclipse.xtext.util.ITextRegionWithLineInformation; /** @@ -21,9 +20,8 @@ import org.eclipse.xtext.util.ITextRegionWithLineInformation; * @since 2.10 */ @ImplementedBy(DefaultHierarchyNodeLocationProvider.class) -@SuppressWarnings("all") public interface IHierarchyNodeLocationProvider { - ITextRegionWithLineInformation getTextRegion(final EObject obj); - - ITextRegionWithLineInformation getTextRegion(final EObject owner, final EStructuralFeature feature, final int indexInList); + ITextRegionWithLineInformation getTextRegion(EObject obj); + + ITextRegionWithLineInformation getTextRegion(EObject owner, EStructuralFeature feature, int indexInList); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.xtend deleted file mode 100644 index eb9c6761d..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeLocationProvider.xtend +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.editor.hierarchy - -import com.google.inject.ImplementedBy -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.EStructuralFeature -import org.eclipse.xtext.util.ITextRegionWithLineInformation - -/** - * This class is used to identify a region for {@link IHierarchyNode} and {@link IHierarchyNodeReference}. - * - * @author kosyakov - Initial contribution and API - * @since 2.10 - */ -@ImplementedBy(DefaultHierarchyNodeLocationProvider) -interface IHierarchyNodeLocationProvider { - def ITextRegionWithLineInformation getTextRegion(EObject obj) - - def ITextRegionWithLineInformation getTextRegion(EObject owner, EStructuralFeature feature, int indexInList) -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.java similarity index 67% rename from org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.java rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.java index 83d8487fd..ee407c4c9 100644 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.java @@ -1,23 +1,22 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. +/******************************************************************************* + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 - */ + *******************************************************************************/ package org.eclipse.xtext.ide.editor.hierarchy; import org.eclipse.xtext.ide.editor.navigation.INavigatable; import org.eclipse.xtext.util.ITextRegionWithLineInformation; /** - * Represents a reference between parent and child nodes. Each reference is backed up with a region and a text. + * Represents a reference between parent and child nodes. Each reference is backed up with a region and a text. * * @author kosyakov - Initial contribution and API * @since 2.10 */ -@SuppressWarnings("all") public interface IHierarchyNodeReference extends INavigatable, ITextRegionWithLineInformation { - String getText(); + String getText(); } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.xtend deleted file mode 100644 index e92675868..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNodeReference.xtend +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.editor.hierarchy - -import org.eclipse.xtext.ide.editor.navigation.INavigatable -import org.eclipse.xtext.util.ITextRegionWithLineInformation - -/** - * Represents a reference between parent and child nodes. Each reference is backed up with a region and a text. - * - * @author kosyakov - Initial contribution and API - * @since 2.10 - */ -interface IHierarchyNodeReference extends INavigatable, ITextRegionWithLineInformation { - def String getText() -} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.java similarity index 54% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.java index 9d4ae43ba..df0e982ef 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.java @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.hierarchy +package org.eclipse.xtext.ide.editor.hierarchy; -import java.util.Collection +import java.util.Collection; +import static java.util.Collections.*; /** * Represents a hierarchy root. @@ -16,16 +17,13 @@ import java.util.Collection * @author kosyakov - Initial contribution and API * @since 2.10 */ -interface IHierarchyRoot { +public interface IHierarchyRoot { + Collection getRoots(); - def Collection getRoots() - - val EMPTY = new IHierarchyRoot() { - - override getRoots() { - emptyList + static final IHierarchyRoot EMPTY = new IHierarchyRoot() { + @Override + public Collection getRoots() { + return emptyList(); } - - } - + }; } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java new file mode 100644 index 000000000..309c5b1e9 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2014, 2020 itemis AG (http://www.itemis.eu) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.xtext.ide.editor.model; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import java.util.Map; +import org.antlr.runtime.Token; +import org.eclipse.xtext.ide.LexerIdeBindings; +import org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles; +import org.eclipse.xtext.parser.antlr.ITokenDefProvider; + +/** + * @author Anton Kosyakov + * + * @since 2.9 + */ +public abstract class TokenTypeToStringMapper { + + private String[] mappedValues; + + @Inject + public void setTokenDefProvider(@Named(LexerIdeBindings.HIGHLIGHTING) ITokenDefProvider tokenDefProvider) { + initIds(tokenDefProvider.getTokenDefMap()); + } + + protected void initIds(Map tokenDefMap) { + mappedValues = new String[tokenDefMap.size()]; + for (Map.Entry entry : tokenDefMap.entrySet()) { + if (entry.getKey() >= Token.MIN_TOKEN_TYPE) { + mappedValues[entry.getKey() - Token.MIN_TOKEN_TYPE] = calculateId(entry.getValue(), entry.getKey()); + } + } + } + + protected abstract String calculateId(String tokenName, int tokenType); + + protected String getMappedValue(int tokenType) { + if (tokenType == Token.INVALID_TOKEN_TYPE) { + return HighlightingStyles.INVALID_TOKEN_ID; + } else { + return mappedValues[tokenType - Token.MIN_TOKEN_TYPE]; + } + } + +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.xtend deleted file mode 100644 index 11ffb2a52..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.xtend +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.model - -import com.google.inject.Inject -import com.google.inject.name.Named -import java.util.Map -import org.antlr.runtime.Token -import org.eclipse.xtext.ide.LexerIdeBindings -import org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles -import org.eclipse.xtext.parser.antlr.ITokenDefProvider - -/** - * @author Anton Kosyakov - * - * @since 2.9 - */ -abstract class TokenTypeToStringMapper { - - String[] mappedValues - - @Inject - def void setTokenDefProvider(@Named(LexerIdeBindings.HIGHLIGHTING) ITokenDefProvider tokenDefProvider) { - initIds(tokenDefProvider.tokenDefMap) - } - - def protected void initIds(Map tokenDefMap) { - mappedValues = newArrayOfSize(tokenDefMap.size) - for (entry : tokenDefMap.entrySet) { - if (entry.key >= Token.MIN_TOKEN_TYPE) { - mappedValues.set(entry.key - Token.MIN_TOKEN_TYPE, calculateId(entry.value, entry.key)) - } - } - } - - def protected abstract String calculateId(String tokenName, int tokenType) - - def protected String getMappedValue(int tokenType) { - if (tokenType == Token.INVALID_TOKEN_TYPE) { - HighlightingStyles.INVALID_TOKEN_ID - } else { - mappedValues.get(tokenType - Token.MIN_TOKEN_TYPE) - } - } - -} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.java similarity index 52% rename from org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.xtend rename to org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.java index 8a72456e6..33f3118e6 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.xtend +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.java @@ -1,26 +1,26 @@ /******************************************************************************* - * Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2014, 2020 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.xtext.ide.editor.syntaxcoloring +package org.eclipse.xtext.ide.editor.syntaxcoloring; /** * @author Anton Kosyakov - Initial contribution and API * @since 2.9 */ -interface HighlightingStyles { +public interface HighlightingStyles { - val KEYWORD_ID = "keyword" - val PUNCTUATION_ID = "punctuation" - val COMMENT_ID = "comment" - val STRING_ID = "string" - val NUMBER_ID = "number" - val DEFAULT_ID = "default" - val INVALID_TOKEN_ID = "error" - val TASK_ID = "task" + String KEYWORD_ID = "keyword"; + String PUNCTUATION_ID = "punctuation"; + String COMMENT_ID = "comment"; + String STRING_ID = "string"; + String NUMBER_ID = "number"; + String DEFAULT_ID = "default"; + String INVALID_TOKEN_ID = "error"; + String TASK_ID = "task"; } diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.java new file mode 100644 index 000000000..67aac2e6f --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2018, 2020 TypeFox and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ide.server.symbol; + +import static java.util.Collections.*; + +import java.util.List; + +import org.eclipse.lsp4j.DocumentSymbol; +import org.eclipse.lsp4j.DocumentSymbolParams; +import org.eclipse.lsp4j.SymbolInformation; +import org.eclipse.lsp4j.jsonrpc.messages.Either; +import org.eclipse.xtext.ide.server.Document; +import org.eclipse.xtext.ide.server.symbol.IDocumentSymbolService.Noop; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.util.CancelIndicator; + +import com.google.common.annotations.Beta; +import com.google.inject.ImplementedBy; + +/** + * Common service interface for providing document symbol information for text documents. + * + *

+ * For more details, see the {@code textDocument/documentSymbol} + * LSP method. + * + *

+ * This interface is not meant to be injected. Use the {@link DocumentSymbolService} and the + * {@link HierarchicalDocumentSymbolService} directly instead. + */ +@Beta +@ImplementedBy(Noop.class) +public interface IDocumentSymbolService { + + List> getSymbols(Document document, XtextResource resource, + DocumentSymbolParams params, CancelIndicator cancelIndicator); + + public static class Noop implements IDocumentSymbolService { + + @Override + public List> getSymbols(Document document, XtextResource resource, + DocumentSymbolParams params, CancelIndicator cancelIndicator) { + + return emptyList(); + } + + } + +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.xtend deleted file mode 100644 index 7fe0c087b..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.xtend +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018 TypeFox and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server.symbol - -import com.google.common.annotations.Beta -import com.google.inject.ImplementedBy -import java.util.List -import org.eclipse.lsp4j.DocumentSymbol -import org.eclipse.lsp4j.DocumentSymbolParams -import org.eclipse.lsp4j.SymbolInformation -import org.eclipse.lsp4j.jsonrpc.messages.Either -import org.eclipse.xtext.ide.server.Document -import org.eclipse.xtext.resource.XtextResource -import org.eclipse.xtext.util.CancelIndicator - -/** - * Common service interface for providing document symbol information for text documents. - * - *

- * For more details, see the {@code textDocument/documentSymbol} LSP method. - * - *

- * This interface is not meant to be injected. Use the {@link DocumentSymbolService} and the {@link HierarchicalDocumentSymbolService} directly instead. - */ -@Beta -@ImplementedBy(Noop) -interface IDocumentSymbolService { - - def List> getSymbols(Document document, XtextResource resource, - DocumentSymbolParams params, CancelIndicator cancelIndicator); - - static class Noop implements IDocumentSymbolService { - - override getSymbols(Document document, XtextResource resource, DocumentSymbolParams params, - CancelIndicator cancelIndicator) { - - return emptyList; - } - - } - -} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java new file mode 100644 index 000000000..1d8a13905 --- /dev/null +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) and others. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.xtext.ide.server.symbol; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import java.util.LinkedList; +import java.util.List; +import org.eclipse.lsp4j.SymbolInformation; +import org.eclipse.xtext.findReferences.IReferenceFinder.IResourceAccess; +import org.eclipse.xtext.resource.IResourceDescription; +import org.eclipse.xtext.resource.IResourceDescriptions; +import org.eclipse.xtext.resource.IResourceServiceProvider; +import org.eclipse.xtext.service.OperationCanceledManager; +import org.eclipse.xtext.util.CancelIndicator; + +/** + * @author kosyakov - Initial contribution and API + * @since 2.11 + */ +@Singleton +public class WorkspaceSymbolService { + + @Inject + private IResourceServiceProvider.Registry registry; + + @Inject + private OperationCanceledManager operationCanceledManager; + + public List getSymbols( + String query, + IResourceAccess resourceAccess, + IResourceDescriptions indexData, + CancelIndicator cancelIndicator + ) { + List result = new LinkedList<>(); + for (IResourceDescription resourceDescription : indexData.getAllResourceDescriptions()) { + operationCanceledManager.checkCanceled(cancelIndicator); + IResourceServiceProvider resourceServiceProvider = registry.getResourceServiceProvider(resourceDescription.getURI()); + if (resourceServiceProvider != null) { + DocumentSymbolService documentSymbolService = resourceServiceProvider.get(DocumentSymbolService.class); + if (documentSymbolService != null) { + result.addAll(documentSymbolService.getSymbols(resourceDescription, query, resourceAccess, cancelIndicator)); + } + } + } + return result; + } + +} diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.xtend b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.xtend deleted file mode 100644 index c033138fd..000000000 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.xtend +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ -package org.eclipse.xtext.ide.server.symbol - -import com.google.inject.Inject -import com.google.inject.Singleton -import java.util.List -import org.eclipse.lsp4j.SymbolInformation -import org.eclipse.xtext.findReferences.IReferenceFinder.IResourceAccess -import org.eclipse.xtext.resource.IResourceDescriptions -import org.eclipse.xtext.resource.IResourceServiceProvider -import org.eclipse.xtext.service.OperationCanceledManager -import org.eclipse.xtext.util.CancelIndicator - -/** - * @author kosyakov - Initial contribution and API - * @since 2.11 - */ -@Singleton -class WorkspaceSymbolService { - - @Inject - extension IResourceServiceProvider.Registry - - @Inject - OperationCanceledManager operationCanceledManager - - def List getSymbols( - String query, - IResourceAccess resourceAccess, - IResourceDescriptions indexData, - CancelIndicator cancelIndicator - ) { - val result = newLinkedList - for (resourceDescription : indexData.allResourceDescriptions) { - operationCanceledManager.checkCanceled(cancelIndicator) - val resourceServiceProvider = resourceDescription.URI.resourceServiceProvider - val documentSymbolService = resourceServiceProvider?.get(DocumentSymbolService) - if (documentSymbolService !== null) { - result += documentSymbolService.getSymbols(resourceDescription, query, resourceAccess, cancelIndicator) - } - } - return result - } - -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.java deleted file mode 100644 index 9d89e865b..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IIdeContentProposalAcceptor.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.contentassist; - -import org.eclipse.xtext.ide.editor.contentassist.ContentAssistEntry; - -/** - * @noreference - */ -@SuppressWarnings("all") -public interface IIdeContentProposalAcceptor { - /** - * Handle the given content assist entry. The entry may be {@code null}. - */ - void accept(final ContentAssistEntry entry, final int priority); - - boolean canAcceptMoreProposals(); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java deleted file mode 100644 index 551c02352..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IPrefixMatcher.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.contentassist; - -import com.google.inject.ImplementedBy; - -/** - * Prefix matchers are used to reject content assist proposals that do not match the prefix at - * the current cursor position. - * - * @since 2.10 - * @noreference - */ -@ImplementedBy(IPrefixMatcher.IgnoreCase.class) -@SuppressWarnings("all") -public interface IPrefixMatcher { - /** - * Default prefix matcher that compares the prefix of the candidate ignoring case. - */ - class IgnoreCase implements IPrefixMatcher { - @Override - public boolean isCandidateMatchingPrefix(final String name, final String prefix) { - return name.regionMatches(true, 0, prefix, 0, prefix.length()); - } - } - - boolean isCandidateMatchingPrefix(final String name, final String prefix); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.java deleted file mode 100644 index 7c82407ab..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/ICallHierarchyBuilder.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.hierarchy; - -import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyBuilder; - -/** - * It is used to build a call hierarchy structure. - * - * @author kosyakov - Initial contribution and API - * @since 2.10 - */ -@SuppressWarnings("all") -public interface ICallHierarchyBuilder extends IHierarchyBuilder { - enum CallHierarchyType { - CALLER, - - CALLEE; - } - - ICallHierarchyBuilder.CallHierarchyType getHierarchyType(); - - void setHierarchyType(final ICallHierarchyBuilder.CallHierarchyType hierarchyType); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.java deleted file mode 100644 index 9cc08aae5..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyBuilder.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.hierarchy; - -import java.util.Collection; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.util.URI; -import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNode; - -/** - * This class is used to build a hierarchy structure. - * - * @author kosyakov - Initial contribution and API - * @since 2.10 - */ -@SuppressWarnings("all") -public interface IHierarchyBuilder { - /** - * @return root hierarchy nodes for the given URI; empty if the hierarchy cannot be built for the given URI - */ - Collection buildRoots(final URI rootURI, final IProgressMonitor monitor); - - /** - * @return child nodes for the given parent node; empty if {@link IHierarchyNode#mayHaveChildren} returns false for the parent - */ - Collection buildChildren(final IHierarchyNode parent, final IProgressMonitor monitor); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.java deleted file mode 100644 index 34097ae0d..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyNode.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.hierarchy; - -import java.util.Collection; -import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNodeReference; -import org.eclipse.xtext.ide.editor.navigation.INavigatable; -import org.eclipse.xtext.resource.IEObjectDescription; - -/** - * Represents a hierarchy node. - * - * @author kosyakov - Initial contribution and API - * @since 2.10 - */ -@SuppressWarnings("all") -public interface IHierarchyNode extends INavigatable { - /** - * @return an associated element that is used to build child nodes - */ - IEObjectDescription getElement(); - - /** - * @return a parent; null if the node is a root - */ - IHierarchyNode getParent(); - - /** - * @return references used to reach the node from a parent; empty if the node is a root - */ - Collection getReferences(); - - /** - * @return whether there is a parent (can be transitive) containing the same element as the node - */ - boolean isRecursive(); - - /** - * @return whether the node may have children; e.g. a recursive node cannot have children - */ - boolean mayHaveChildren(); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.java deleted file mode 100644 index 63680df34..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/hierarchy/IHierarchyRoot.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.hierarchy; - -import java.util.Collection; -import org.eclipse.xtext.ide.editor.hierarchy.IHierarchyNode; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; - -/** - * Represents a hierarchy root. - * - * @author kosyakov - Initial contribution and API - * @since 2.10 - */ -@SuppressWarnings("all") -public interface IHierarchyRoot { - Collection getRoots(); - - static final IHierarchyRoot EMPTY = new IHierarchyRoot() { - @Override - public Collection getRoots() { - return CollectionLiterals.emptyList(); - } - }; -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java deleted file mode 100644 index 2c0fad3fa..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/model/TokenTypeToStringMapper.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.model; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import java.util.Map; -import java.util.Set; -import org.antlr.runtime.Token; -import org.eclipse.xtext.ide.LexerIdeBindings; -import org.eclipse.xtext.ide.editor.syntaxcoloring.HighlightingStyles; -import org.eclipse.xtext.parser.antlr.ITokenDefProvider; - -/** - * @author Anton Kosyakov - * - * @since 2.9 - */ -@SuppressWarnings("all") -public abstract class TokenTypeToStringMapper { - private String[] mappedValues; - - @Inject - public void setTokenDefProvider(@Named(LexerIdeBindings.HIGHLIGHTING) final ITokenDefProvider tokenDefProvider) { - this.initIds(tokenDefProvider.getTokenDefMap()); - } - - protected void initIds(final Map tokenDefMap) { - this.mappedValues = new String[tokenDefMap.size()]; - Set> _entrySet = tokenDefMap.entrySet(); - for (final Map.Entry entry : _entrySet) { - Integer _key = entry.getKey(); - boolean _greaterEqualsThan = ((_key).intValue() >= Token.MIN_TOKEN_TYPE); - if (_greaterEqualsThan) { - Integer _key_1 = entry.getKey(); - int _minus = ((_key_1).intValue() - Token.MIN_TOKEN_TYPE); - this.mappedValues[_minus] = this.calculateId(entry.getValue(), (entry.getKey()).intValue()); - } - } - } - - protected abstract String calculateId(final String tokenName, final int tokenType); - - protected String getMappedValue(final int tokenType) { - String _xifexpression = null; - if ((tokenType == Token.INVALID_TOKEN_TYPE)) { - _xifexpression = HighlightingStyles.INVALID_TOKEN_ID; - } else { - _xifexpression = this.mappedValues[(tokenType - Token.MIN_TOKEN_TYPE)]; - } - return _xifexpression; - } -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.java deleted file mode 100644 index 7fbbe8050..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/syntaxcoloring/HighlightingStyles.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.editor.syntaxcoloring; - -/** - * @author Anton Kosyakov - Initial contribution and API - * @since 2.9 - */ -@SuppressWarnings("all") -public interface HighlightingStyles { - static final String KEYWORD_ID = "keyword"; - - static final String PUNCTUATION_ID = "punctuation"; - - static final String COMMENT_ID = "comment"; - - static final String STRING_ID = "string"; - - static final String NUMBER_ID = "number"; - - static final String DEFAULT_ID = "default"; - - static final String INVALID_TOKEN_ID = "error"; - - static final String TASK_ID = "task"; -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.java deleted file mode 100644 index 9221aa717..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/IDocumentSymbolService.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2018 TypeFox and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server.symbol; - -import com.google.common.annotations.Beta; -import com.google.inject.ImplementedBy; -import java.util.List; -import org.eclipse.lsp4j.DocumentSymbol; -import org.eclipse.lsp4j.DocumentSymbolParams; -import org.eclipse.lsp4j.SymbolInformation; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.eclipse.xtext.ide.server.Document; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.util.CancelIndicator; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; - -/** - * Common service interface for providing document symbol information for text documents. - * - *

- * For more details, see the {@code textDocument/documentSymbol} LSP method. - * - *

- * This interface is not meant to be injected. Use the {@link DocumentSymbolService} and the {@link HierarchicalDocumentSymbolService} directly instead. - */ -@Beta -@ImplementedBy(IDocumentSymbolService.Noop.class) -@SuppressWarnings("all") -public interface IDocumentSymbolService { - class Noop implements IDocumentSymbolService { - @Override - public List> getSymbols(final Document document, final XtextResource resource, final DocumentSymbolParams params, final CancelIndicator cancelIndicator) { - return CollectionLiterals.>emptyList(); - } - } - - List> getSymbols(final Document document, final XtextResource resource, final DocumentSymbolParams params, final CancelIndicator cancelIndicator); -} diff --git a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java b/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java deleted file mode 100644 index b34bfcfba..000000000 --- a/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/server/symbol/WorkspaceSymbolService.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.eclipse.xtext.ide.server.symbol; - -import com.google.common.collect.Iterables; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.util.LinkedList; -import java.util.List; -import org.eclipse.lsp4j.SymbolInformation; -import org.eclipse.xtext.findReferences.IReferenceFinder; -import org.eclipse.xtext.ide.server.symbol.DocumentSymbolService; -import org.eclipse.xtext.resource.IResourceDescription; -import org.eclipse.xtext.resource.IResourceDescriptions; -import org.eclipse.xtext.resource.IResourceServiceProvider; -import org.eclipse.xtext.service.OperationCanceledManager; -import org.eclipse.xtext.util.CancelIndicator; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * @author kosyakov - Initial contribution and API - * @since 2.11 - */ -@Singleton -@SuppressWarnings("all") -public class WorkspaceSymbolService { - @Inject - @Extension - private IResourceServiceProvider.Registry _registry; - - @Inject - private OperationCanceledManager operationCanceledManager; - - public List getSymbols(final String query, final IReferenceFinder.IResourceAccess resourceAccess, final IResourceDescriptions indexData, final CancelIndicator cancelIndicator) { - final LinkedList result = CollectionLiterals.newLinkedList(); - Iterable _allResourceDescriptions = indexData.getAllResourceDescriptions(); - for (final IResourceDescription resourceDescription : _allResourceDescriptions) { - { - this.operationCanceledManager.checkCanceled(cancelIndicator); - final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(resourceDescription.getURI()); - DocumentSymbolService _get = null; - if (resourceServiceProvider!=null) { - _get=resourceServiceProvider.get(DocumentSymbolService.class); - } - final DocumentSymbolService documentSymbolService = _get; - if ((documentSymbolService != null)) { - List _symbols = documentSymbolService.getSymbols(resourceDescription, query, resourceAccess, cancelIndicator); - Iterables.addAll(result, _symbols); - } - } - } - return result; - } -}