Class PropertyValueCompletionProvider
java.lang.Object
org.fife.ui.autocomplete.CompletionProviderBase
org.fife.rsta.ac.css.PropertyValueCompletionProvider
- All Implemented Interfaces:
org.fife.ui.autocomplete.CompletionProvider
- Direct Known Subclasses:
LessCodeCompletionProvider
public class PropertyValueCompletionProvider
extends org.fife.ui.autocomplete.CompletionProviderBase
The completion provider used for CSS properties and values.
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumA simple enum to keep track of what "state" we're in at a specific location in a CSS file. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.fife.ui.autocomplete.AbstractCompletionProvider.CaseInsensitiveComparatorprivate StringIf we're going to display value completions for a property, this is the property to do it for.private List<org.fife.ui.autocomplete.Completion> private final org.fife.ui.autocomplete.Completionprivate booleanprivate List<org.fife.ui.autocomplete.Completion> private Segmentprivate Map<String, List<CompletionGenerator>> private static final PatternThe most common vendor prefixes.Fields inherited from class org.fife.ui.autocomplete.CompletionProviderBase
EMPTY_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidadd(Map<String, List<CompletionGenerator>> generatorMap, String prop, CompletionGenerator generator) Adds a completion generator for a specific property.private voidaddAtRuleCompletions(List<org.fife.ui.autocomplete.Completion> completions) protected booleanaddLessCompletions(List<org.fife.ui.autocomplete.Completion> completions, PropertyValueCompletionProvider.LexerState state, JTextComponent comp, String alreadyEntered) Adds completions specific to Less.List<org.fife.ui.autocomplete.Completion> getCompletionsAt(JTextComponent comp, Point p) protected List<org.fife.ui.autocomplete.Completion> getLexerState(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int line) List<org.fife.ui.autocomplete.ParameterizedCompletion> booleanbooleanisValidChar(char ch) Returns whether a character is valid in a property value.private List<org.fife.ui.autocomplete.Completion> loadFromXML(InputStream in, ClassLoader cl) Loads completions from an XML input stream.protected List<org.fife.ui.autocomplete.Completion> loadFromXML(String resource) Loads completions from an XML file.private List<org.fife.ui.autocomplete.Completion> private voidprivate voidprivate static StringremoveVendorPrefix(String text) Methods inherited from class org.fife.ui.autocomplete.CompletionProviderBase
clearParameterizedCompletionParams, getCompletions, getListCellRenderer, getParameterChoicesProvider, getParameterListEnd, getParameterListSeparator, getParameterListStart, getParent, setAutoActivationRules, setListCellRenderer, setParameterChoicesProvider, setParameterizedCompletionParams, setParent
-
Field Details
-
htmlTagCompletions
-
propertyCompletions
-
valueCompletions
-
valueCompletionGenerators
-
seg
-
comparator
private org.fife.ui.autocomplete.AbstractCompletionProvider.CaseInsensitiveComparator comparator -
currentProperty
If we're going to display value completions for a property, this is the property to do it for. -
isLess
private boolean isLess -
VENDOR_PREFIXES
The most common vendor prefixes. We ignore these. -
inheritCompletion
private final org.fife.ui.autocomplete.Completion inheritCompletion
-
-
Constructor Details
-
PropertyValueCompletionProvider
public PropertyValueCompletionProvider(boolean isLess)
-
-
Method Details
-
addAtRuleCompletions
-
getAlreadyEnteredText
-
removeVendorPrefix
-
getCompletionsAt
-
getParameterizedCompletions
public List<org.fife.ui.autocomplete.ParameterizedCompletion> getParameterizedCompletions(JTextComponent tc) -
getLexerState
private PropertyValueCompletionProvider.LexerState getLexerState(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int line) -
getCompletionsImpl
- Specified by:
getCompletionsImplin classorg.fife.ui.autocomplete.CompletionProviderBase
-
addLessCompletions
protected boolean addLessCompletions(List<org.fife.ui.autocomplete.Completion> completions, PropertyValueCompletionProvider.LexerState state, JTextComponent comp, String alreadyEntered) Adds completions specific to Less. The default implementation does nothing; subclasses can override.- Parameters:
completions- The completion set to add to.state- The current lexer state.comp- The text component whose content is being parsed.alreadyEntered- The text already entered by the user.- Returns:
- Whether any completions were added.
-
isAutoActivateOkay
- Specified by:
isAutoActivateOkayin interfaceorg.fife.ui.autocomplete.CompletionProvider- Overrides:
isAutoActivateOkayin classorg.fife.ui.autocomplete.CompletionProviderBase
-
isValidChar
public boolean isValidChar(char ch) Returns whether a character is valid in a property value.- Parameters:
ch- The character.- Returns:
- Whether it is valid.
-
loadHtmlTagCompletions
- Throws:
IOException
-
loadPropertyCompletions
- Throws:
IOException
-
loadFromXML
private List<org.fife.ui.autocomplete.Completion> loadFromXML(InputStream in, ClassLoader cl) throws IOException Loads completions from an XML input stream. The XML should validate againstCompletionXml.dtd.- Parameters:
in- The input stream to read from.cl- The class loader to use when loading any extra classes defined in the XML, such as customFunctionCompletions. This may benullif the default is to be used, or if no custom completions are defined in the XML.- Throws:
IOException- If an IO error occurs.
-
loadFromXML
Loads completions from an XML file. The XML should validate againstCompletionXml.dtd.- Parameters:
resource- A resource the current ClassLoader can get to.- Throws:
IOException- If an IO error occurs.
-
add
private static void add(Map<String, List<CompletionGenerator>> generatorMap, String prop, CompletionGenerator generator) Adds a completion generator for a specific property. -
parsePropertyValueCompletionLine
-