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
  • Field Details

    • htmlTagCompletions

      private List<org.fife.ui.autocomplete.Completion> htmlTagCompletions
    • propertyCompletions

      private List<org.fife.ui.autocomplete.Completion> propertyCompletions
    • valueCompletions

      private Map<String,List<org.fife.ui.autocomplete.Completion>> valueCompletions
    • valueCompletionGenerators

      private Map<String,List<CompletionGenerator>> valueCompletionGenerators
    • seg

      private Segment seg
    • comparator

      private org.fife.ui.autocomplete.AbstractCompletionProvider.CaseInsensitiveComparator comparator
    • currentProperty

      private String 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

      private static final Pattern 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

      private void addAtRuleCompletions(List<org.fife.ui.autocomplete.Completion> completions)
    • getAlreadyEnteredText

      public String getAlreadyEnteredText(JTextComponent comp)
    • removeVendorPrefix

      private static String removeVendorPrefix(String text)
    • getCompletionsAt

      public List<org.fife.ui.autocomplete.Completion> getCompletionsAt(JTextComponent comp, Point p)
    • 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

      protected List<org.fife.ui.autocomplete.Completion> getCompletionsImpl(JTextComponent comp)
      Specified by:
      getCompletionsImpl in class org.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

      public boolean isAutoActivateOkay(JTextComponent tc)
      Specified by:
      isAutoActivateOkay in interface org.fife.ui.autocomplete.CompletionProvider
      Overrides:
      isAutoActivateOkay in class org.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

      private List<org.fife.ui.autocomplete.Completion> loadHtmlTagCompletions() throws IOException
      Throws:
      IOException
    • loadPropertyCompletions

      private void loadPropertyCompletions() throws IOException
      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 against CompletionXml.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 custom FunctionCompletions. This may be null if the default is to be used, or if no custom completions are defined in the XML.
      Throws:
      IOException - If an IO error occurs.
    • loadFromXML

      protected List<org.fife.ui.autocomplete.Completion> loadFromXML(String resource) throws IOException
      Loads completions from an XML file. The XML should validate against CompletionXml.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

      private void parsePropertyValueCompletionLine(String line)