GVKun编程网logo

com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码(comparable源码)

5

如果您想了解com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码和comparable源码的知识,那么本篇文章将是您的不二之选。我们将

如果您想了解com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码comparable源码的知识,那么本篇文章将是您的不二之选。我们将深入剖析com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码的各个方面,并为您解答comparable源码的疑在这篇文章中,我们将为您介绍com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码的相关知识,同时也会详细的解释comparable源码的运用方法,并给出实际的案例分析,希望能帮助到您!

本文目录一览:

com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码(comparable源码)

com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码(comparable源码)

项目:intellij-ce-playground    文件:PropertyStubElementType.java   
public PropertyStub createStub(@NotNull final Property psi,final StubElement parentStub) {
  return new PropertyStubImpl(parentStub,psi.getKey());
}
项目:intellij-ce-playground    文件:PropertyStubElementType.java   
@NotNull
public PropertyStub deserialize(@NotNull final StubInputStream dataStream,final StubElement parentStub) throws IOException {
  final StringRef ref = dataStream.readName();
  return new PropertyStubImpl(parentStub,ref.getString());
}
项目:intellij-ce-playground    文件:PropertyStubElementType.java   
@Override
public PropertyStub createStub(LighteraST tree,LighteraSTNode node,StubElement parentStub) {
  LighteraSTNode keyNode = LightTreeUtil.firstChildOfType(tree,node,PropertiesTokenTypes.KEY_CHaraCTERS);
  String key = intern(tree.getCharTable(),keyNode);
  return new PropertyStubImpl(parentStub,key);
}
项目:tools-idea    文件:PropertyStubElementType.java   
public PropertyStub createStub(@NotNull final Property psi,psi.getKey());
}
项目:tools-idea    文件:PropertyStubElementType.java   
@NotNull
public PropertyStub deserialize(@NotNull final StubInputStream dataStream,ref.getString());
}

com.hazelcast.config.properties.SimplePropertyDefinition的实例源码

com.hazelcast.config.properties.SimplePropertyDefinition的实例源码

项目:hazelcast-heroku-discovery    文件:HerokudiscoveryStrategy.java   
public HerokudiscoveryStrategy(ILogger logger,Map<String,Comparable> properties) {
  super(logger,properties);

  String serviceNamesProp = getorNull(new SimplePropertyDeFinition("serviceNames",PropertyTypeConverter.STRING));
  if (serviceNamesProp == null) {
    String formationName = System.getenv("HEROKU_DNS_FORMATION_NAME");
    if (formationName == null) {
      throw new IllegalArgumentException("You must enable Heroku DNS Service discovery for this Hazelcast plugin to work!");
    } else {
      this.serviceNames = Collections.unmodifiableCollection(Arrays.asList(formationName));
    }
  } else {
    List<String> serviceNamesList = new ArrayList<>();
    for (String serviceName : serviceNamesProp.split(";")) {
      String appName = System.getenv("HEROKU_DNS_APP_NAME");
      if (appName == null) {
        throw new IllegalArgumentException("You must enable Heroku DNS Service discovery for this Hazelcast plugin to work!");
      } else {
        serviceNamesList.add(serviceName + "." + appName);
      }
    }
    this.serviceNames = Collections.unmodifiableCollection(serviceNamesList);
  }

  String mergeDelay = getorNull(new SimplePropertyDeFinition("mergeDelay",PropertyTypeConverter.STRING));
  System.setProperty("hazelcast.merge.first.run.delay.seconds",mergeDelay == null ? "20" : mergeDelay);

  // Todo parse /etc/heroku/space-topology.json instead,// but that should go in a separate library
  Security.setProperty("networkaddress.cache.ttl","20");
  Security.setProperty("networkaddress.cache.negative.ttl","0");
}
项目:hazelcast-consul-spi    文件:ConsuldiscoveryFactory.java   
public ConsuldiscoveryFactory() {
    List<PropertyDeFinition> properties = new ArrayList<>();
    properties.add(new SimplePropertyDeFinition("host",PropertyTypeConverter.STRING));
    properties.add(new SimplePropertyDeFinition("port",PropertyTypeConverter.INTEGER));
    properties.add(new SimplePropertyDeFinition("name",PropertyTypeConverter.STRING));
    this.propertyDeFinitions = Collections.unmodifiableCollection(properties);
}
项目:hazelcast-consul-discovery    文件:ConsuldiscoveryFactory.java   
public ConsuldiscoveryFactory() {
    List<PropertyDeFinition> properties = new ArrayList<>();
    properties.add(new SimplePropertyDeFinition("host",PropertyTypeConverter.STRING));
    this.propertyDeFinitions = Collections.unmodifiableCollection(properties);
}
项目:hazelcast-zookeeper    文件:ZookeeperdiscoveryProperties.java   
private static PropertyDeFinition property(String key,PropertyTypeConverter typeConverter,ValueValidator valueValidator) {
    return new SimplePropertyDeFinition(key,true,typeConverter,valueValidator);
}
项目:hazelcast-eureka    文件:EurekaOneProperties.java   
private static PropertyDeFinition property(String key,TypeConverter typeConverter) {
    return new SimplePropertyDeFinition(key,typeConverter);
}
项目:hazelcast-jclouds    文件:JCloudsProperties.java   
private static PropertyDeFinition property(String key,valueValidator);
}
项目:hzkeeper    文件:ZookeeperdiscoveryProperties.java   
private static PropertyDeFinition property(String key,valueValidator);
}
项目:hazelcast-kubernetes    文件:KubernetesProperties.java   
private static PropertyDeFinition property(String key,typeConverter);
}

com.intellij.lang.properties.IProperty的实例源码

com.intellij.lang.properties.IProperty的实例源码

项目:hybris-integration-intellij-idea-plugin    文件:JspPropertyFoldingBuilder.java   
@Nullable
private static IProperty getResolvedProperty(@NotNull final XmlAttributeValue codeValue) {
    return CachedValuesManager.getCachedValue(codeValue,KEY,() -> {
        List<IProperty> allProperties = new SmartList<>();
        for (PsiReference nextRef : codeValue.getReferences()) {
            if (nextRef instanceof PsipolyVariantReference) {
                Arrays.stream(((PsipolyVariantReference) nextRef).multiResolve(false))
                      .filter(ResolveResult::isValidResult)
                      .map(ResolveResult::getElement)
                      .map(o -> ObjectUtils.tryCast(o,IProperty.class))
                      .filter(Objects::nonNull)
                      .forEach(allProperties::add);
            } else {
                Optional.ofNullable(nextRef.resolve())
                        .map(o -> ObjectUtils.tryCast(o,IProperty.class))
                        .ifPresent(allProperties::add);
            }
        }

        IProperty theChosenOne = chooseForLocale(allProperties);
        return new CachedValueProvider.Result<>(theChosenOne,PsiModificationTracker.MODIFICATION_COUNT);
    });
}
项目:hybris-integration-intellij-idea-plugin    文件:JspPropertyFoldingBuilder.java   
private static IProperty chooseForLocale(
    final @NotNull List<Locale.LanguageRange> priorityList,final @NotNull List<IProperty> properties
) {
    if (properties.isEmpty()) {
        return null;
    }
    IProperty first = properties.get(0);
    if (properties.size() == 1) {
        return first;
    }
    final Map<Locale,IProperty> map = new HashMap<>();
    final List<Locale> locales = new LinkedList<>();
    for (IProperty nextProperty : properties) {
        Locale nextLocale = safeGetLocale(nextProperty);
        if (nextLocale != null) {
            map.put(nextLocale,nextProperty);
            locales.add(nextLocale);
        }
    }

    Locale best = Locale.lookup(priorityList,locales);
    //System.err.println("found locales: " + locales + ",best: " + best + ",result: " + map.get(best));
    return Optional.ofNullable(best).map(map::get).orElse(first);
}
项目:intellij-plugin    文件:CoffigDocumentationProvider.java   
private Optional<ConfigInfo> extractConfigInfo(PropertiesFile propertiesFile,CoffigResolver.Match match) {
    Optional<String> description = Optional.ofNullable(propertiesFile.findPropertyByKey(match.getUnmatchedpath())).map(IProperty::getValue);
    if (description.isPresent()) {
        // Base info
        ConfigInfo configInfo = new ConfigInfo(match.getFullPath(),description.get());

        // Extended info
        Optional.ofNullable(propertiesFile.findPropertyByKey(match.getUnmatchedpath() + ".long")).map(IProperty::getValue).ifPresent(configInfo::setLongDescription);

        // Field info
        CoffigResolver.Match resolvedMatch = match.fullyResolve();
        if (resolvedMatch.isFullyResolved()) {
            Optional<PsiField> psiField = resolvedMatch.resolveField(resolvedMatch.getUnmatchedpath());
            psiField.map(PsiVariable::getType).map(PsiType::getPresentableText).ifPresent(configInfo::setType);
        }

        return Optional.of(configInfo);
    }
    return Optional.empty();
}
项目:mule-intellij-plugins    文件:DecryptPropertyAction.java   
@Override
public void update(AnActionEvent anActionEvent) {
    final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(anActionEvent.getDataContext());

    boolean isProperty = false;
    boolean isPropertyFile = false;
    boolean isEncrypted = false;

    if (file != null) {
        isPropertyFile = "properties".equalsIgnoreCase(file.getExtension());
        if (isPropertyFile) {
            IProperty selectedProperty = getSelectedProperty(anActionEvent.getDataContext());
            if (selectedProperty != null) {
                String propertyValue = selectedProperty.getValue();
                isEncrypted = (propertyValue.startsWith("![") && propertyValue.endsWith("]"));
                isProperty = true;
            }
        }
    }
    anActionEvent.getPresentation().setEnabled(isPropertyFile && isEncrypted && isProperty);
    anActionEvent.getPresentation().setVisible(isPropertyFile && isProperty);
}
项目:mule-intellij-plugins    文件:EncryptPropertyAction.java   
@Override
public void update(AnActionEvent anActionEvent)
{
    final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(anActionEvent.getDataContext());

    boolean isProperty = false;
    boolean isPropertyFile = false;
    boolean isEncrypted = false;

    if (file != null)
    {
        isPropertyFile = "properties".equalsIgnoreCase(file.getExtension());
        if (isPropertyFile) {

            IProperty selectedProperty = getSelectedProperty(anActionEvent.getDataContext());
            if (selectedProperty != null) {
                String propertyValue = selectedProperty.getValue();
                isEncrypted = (propertyValue.startsWith("![") && propertyValue.endsWith("]"));
                isProperty = true;
            }
        }
    }

    anActionEvent.getPresentation().setEnabled(isPropertyFile && !isEncrypted && isProperty);
    anActionEvent.getPresentation().setVisible(isPropertyFile && isProperty);
}
项目:intellij-ce-playground    文件:GradleImplicitPropertyUsageProviderTest.java   
public void testLocalProperties() {
  VirtualFile vFile = myFixture.copyFiletoProject("test.properties","local.properties");
  PsiFile file = PsiManager.getInstance(getProject()).findFile(vFile);
  assertNotNull(file);
  PropertiesFile propertiesFile = (PropertiesFile)file;
  GradleImplicitPropertyUsageProvider provider = new GradleImplicitPropertyUsageProvider();
  for (IProperty property : propertiesFile.getProperties()) {
    Property p = (Property)property;
    // Only but the property with "unused" in its name are considered used
    String name = property.getName();
    if (name.contains("unused")) {
      assertFalse(name,provider.isUsed(p));
    } else {
      assertTrue(name,provider.isUsed(p));
    }
  }
}
项目:intellij-ce-playground    文件:ResourceBundleKeyReference.java   
public PsiElement resolve() {
  final Project project = myFile.getProject();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final VirtualFile formVirtualFile = myFile.getVirtualFile();
  if (formVirtualFile == null) {
    return null;
  }
  final Module module = fileIndex.getModuleForFile(formVirtualFile);
  if (module == null) {
    return null;
  }
  final PropertiesFile propertiesFile = PropertiesUtilBase.getPropertiesFile(myBundleName,module,null);
  if (propertiesFile == null) {
    return null;
  }
  IProperty property = propertiesFile.findPropertyByKey(getRangeText());
  return property == null ? null : property.getPsiElement();
}
项目:intellij-ce-playground    文件:StringDescriptorManager.java   
@Nullable public String resolve(@Nullable StringDescriptor descriptor,@Nullable Locale locale) {
  if (descriptor == null) {
    return null;
  }

  if (descriptor.getValue() != null) {
    return descriptor.getValue();
  }

  IProperty prop = resolvetoProperty(descriptor,locale);
  if (prop != null) {
    final String value = prop.getUnescapedValue();
    if (value != null) {
      return value;
    }
  }
  // We have to return surrogate string in case if propFile name is invalid or bundle doesn't have specified key
  return "[" + descriptor.getKey() + " / " + descriptor.getBundleName() + "]";
}
项目:intellij-ce-playground    文件:StringDescriptorManager.java   
public IProperty resolvetoProperty(@NotNull StringDescriptor descriptor,@Nullable Locale locale) {
  String propFileName = descriptor.getDottedBundleName();
  Pair<Locale,String> cacheKey = Pair.create(locale,propFileName);
  PropertiesFile propertiesFile;
  synchronized (myPropertiesFileCache) {
    propertiesFile = myPropertiesFileCache.get(cacheKey);
  }
  if (propertiesFile == null || !propertiesFile.getContainingFile().isValid()) {
    propertiesFile = PropertiesUtilBase.getPropertiesFile(propFileName,myModule,locale);
    synchronized (myPropertiesFileCache) {
      myPropertiesFileCache.put(cacheKey,propertiesFile);
    }
  }

  if (propertiesFile != null) {
    final IProperty propertyByKey = propertiesFile.findPropertyByKey(descriptor.getKey());
    if (propertyByKey != null) {
      return propertyByKey;
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:I18nizeQuickFixDialog.java   
@NotNull
protected List<String> getExistingValueKeys(String value) {
  if(!myCustomization.suggestExistingProperties) {
    return Collections.emptyList();
  }
  final ArrayList<String> result = new ArrayList<String>();

  // check if property value already exists among properties file values and suggest corresponding key
  PropertiesFile propertiesFile = getPropertiesFile();
  if (propertiesFile != null) {
    for (IProperty property : propertiesFile.getProperties()) {
      if (Comparing.strEqual(property.getValue(),value)) {
        result.add(0,property.getUnescapedKey());
      }
    }
  }
  return result;
}
项目:intellij-ce-playground    文件:I18nizeQuickFixDialog.java   
@Override
protected void doOKAction() {
  if (!createPropertiesFileIfNotExists()) return;
  Collection<PropertiesFile> propertiesFiles = getAllPropertiesFiles();
  for (PropertiesFile propertiesFile : propertiesFiles) {
    IProperty existingProperty = propertiesFile.findPropertyByKey(getKey());
    final String propValue = myValue.getText();
    if (existingProperty != null && !Comparing.strEqual(existingProperty.getValue(),propValue)) {
      final String messageText = CodeInsightBundle.message("i18nize.dialog.error.property.already.defined.message",getKey(),propertiesFile.getName());
      final int code = Messages.showOkCancelDialog(myProject,messageText,CodeInsightBundle.message("i18nize.dialog.error.property.already.defined.title"),null);
      if (code == Messages.CANCEL) {
        return;
      }
    }
  }

  super.doOKAction();
}
项目:intellij-ce-playground    文件:ResourceBundleUtil.java   
/**
 * Tries to derive {@link com.intellij.lang.properties.ResourceBundle resource bundle} related to the given context.
 *
 * @param dataContext   target context
 * @return              {@link com.intellij.lang.properties.ResourceBundle resource bundle} related to the given context if any;
 *                      <code>null</code> otherwise
 */
@Nullable
public static ResourceBundle getResourceBundleFromDataContext(@NotNull DataContext dataContext) {
  PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
  if (element instanceof IProperty) return null; //rename property
  final ResourceBundle[] bundles = ResourceBundle.ARRAY_DATA_KEY.getData(dataContext);
  if (bundles != null && bundles.length == 1) return bundles[0];
  VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
  if (virtualFile == null) {
    return null;
  }
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  if (virtualFile instanceof ResourceBundleAsVirtualFile && project != null) {
    return ((ResourceBundleAsVirtualFile)virtualFile).getResourceBundle();
  }
  if (project != null) {
    final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
    if (psiFile instanceof PropertiesFile) {
      return ((PropertiesFile)psiFile).getResourceBundle();
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:IgnoreIncompletePropertyPropertiesFilesAction.java   
@Override
public void update(AnActionEvent e) {
  final FileEditor fileEditor = PlatformDataKeys.FILE_EDITOR.getData(e.getDataContext());
  if (fileEditor instanceof ResourceBundleEditor) {
    ResourceBundleEditor resourceBundleEditor = (ResourceBundleEditor)fileEditor;
    final Project project = getEventProject(e);
    if (project != null) {
      if (!processSelectedIncompleteProperties(new Processor<IProperty>() {
        @Override
        public boolean process(IProperty property) {
          return false;
        }
      },resourceBundleEditor,project)) {
        e.getPresentation().setEnabledAndVisible(true);
        return;
      }
    }
  }
  e.getPresentation().setEnabledAndVisible(false);
}
项目:intellij-ce-playground    文件:IgnoreIncompletePropertyPropertiesFilesAction.java   
private static boolean processSelectedIncompleteProperties(final @NotNull Processor<IProperty> processor,final @NotNull ResourceBundleEditor resourceBundleEditor,final @NotNull Project project) {
  final IgnoredPropertiesFilesSuffixesManager suffixesManager = IgnoredPropertiesFilesSuffixesManager.getInstance(project);
  for (ResourceBundleEditorViewElement element : resourceBundleEditor.getSelectedElements()) {
    final IProperty[] properties = element.getProperties();
    if (properties != null) {
      for (IProperty property : properties) {
        if (!suffixesManager.isPropertyComplete(resourceBundleEditor.getResourceBundle(),property.getKey()) && !processor.process(property)) {
          return false;
        }
      }
    }
  }
  return true;
}
项目:intellij-ce-playground    文件:ResourceBundleStructureViewComponent.java   
@Override
public void deleteElement(@NotNull final DataContext dataContext) {
  final List<PropertiesFile> bundlePropertiesFiles = myResourceBundle.getPropertiesFiles();

  final List<PsiElement> toDelete = new ArrayList<PsiElement>();
  for (IProperty property : myProperties) {
    final String key = property.getKey();
    if (key == null) {
      LOG.error("key must be not null " + property);
    } else {
      for (PropertiesFile propertiesFile : bundlePropertiesFiles) {
        for (final IProperty iProperty : propertiesFile.findPropertiesByKey(key)) {
          toDelete.add(iProperty.getPsiElement());
        }
      }
    }
  }
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  LOG.assertTrue(project != null);
  new SafeDeleteHandler().invoke(project,PsiUtilCore.toPsiElementArray(toDelete),dataContext);
  myInsertDeleteManager.reload();
}
项目:intellij-ce-playground    文件:ResourceBundlePropertiesUpdateManager.java   
public void insertOrUpdateTranslation(String key,String value,final PropertiesFile propertiesFile) throws IncorrectOperationException {
  final IProperty property = propertiesFile.findPropertyByKey(key);
  if (property != null) {
    property.setValue(value);
    return;
  }

  if (myOrdered) {
    if (myAlphaSorted) {
      propertiesFile.addProperty(key,value);
      return;
    }
    final Pair<IProperty,Integer> propertyAndPosition = findExistedPrevSiblingProperty(key,propertiesFile);
    propertiesFile.addPropertyAfter(key,value,propertyAndPosition == null ? null : (Property)propertyAndPosition.getFirst());
  }
  else {
    insertPropertyLast(key,propertiesFile);
  }
}
项目:intellij-ce-playground    文件:ResourceBundlePropertiesUpdateManager.java   
public void deletePropertyIfExist(String key,PropertiesFile file) {
  final IProperty property = file.findPropertyByKey(key);
  if (property != null && myKeysOrder != null) {
    boolean keyExistInOtherPropertiesFiles = false;
    for (PropertiesFile propertiesFile : myResourceBundle.getPropertiesFiles()) {
      if (!propertiesFile.equals(file) && propertiesFile.findPropertyByKey(key) != null) {
        keyExistInOtherPropertiesFiles = true;
        break;
      }
    }
    if (!keyExistInOtherPropertiesFiles) {
      myKeysOrder.remove(key);
    }
  }
  if (property != null) {
    property.getPsiElement().delete();
  }
}
项目:intellij-ce-playground    文件:RenamePropertyProcessor.java   
@Override
public void findCollisions(PsiElement element,final String newName,Map<? extends PsiElement,String> allRenames,List<UsageInfo> result) {
  for (final Map.Entry<? extends PsiElement,String> e: allRenames.entrySet()) {
    for (IProperty property : ((PropertiesFile)e.getKey().getContainingFile()).getProperties()) {
      if (Comparing.strEqual(e.getValue(),property.getKey())) {
        result.add(new UnresolvableCollisionUsageInfo(property.getPsiElement(),e.getKey()) {
          @Override
          public String getDescription() {
            return "New property name \'" + e.getValue() + "\' hides existing property";
          }
        });
      }
    }
  }
}
项目:intellij-ce-playground    文件:TrailingSpacesInPropertyinspection.java   
public ProblemDescriptor[] checkFile(@NotNull PsiFile file,@NotNull final inspectionManager manager,final boolean isOnTheFly) {
  if (!(file instanceof PropertiesFile)) return null;
  final List<IProperty> properties = ((PropertiesFile)file).getProperties();
  final List<ProblemDescriptor> descriptors = new SmartList<ProblemDescriptor>();
  for (IProperty property : properties) {
    ProgressManager.checkCanceled();
    final PropertyImpl propertyImpl = (PropertyImpl)property;
    for (ASTNode node : ContainerUtil.ar(propertyImpl.getKeyNode(),propertyImpl.getValueNode())) {
      if (node != null) {
        PsiElement key = node.getPsi();
        TextRange textRange = getTrailingSpaces(key,myIgnoreVisibleSpaces);
        if (textRange != null) {
          descriptors.add(manager.createProblemDescriptor(key,textRange,"Trailing spaces",ProblemHighlightType.GENERIC_ERROR_OR_WARNING,true,new RemoveTrailingSpacesFix(myIgnoreVisibleSpaces)));
        }
      }
    }
  }
  return descriptors.toArray(new ProblemDescriptor[descriptors.size()]);
}
项目:intellij-ce-playground    文件:PropertiesPrefixGroup.java   
@NotNull
@Override
public IProperty[] getProperties() {
  final List<IProperty> elements = ContainerUtil.mapNotNull(getChildren(),new NullableFunction<TreeElement,IProperty>() {
    @Nullable
    @Override
    public IProperty fun(final TreeElement treeElement) {
      if (treeElement instanceof PropertiesstructureViewElement) {
        PropertiesstructureViewElement propertiesElement = (PropertiesstructureViewElement)treeElement;
        return propertiesElement.getValue();
      }
      else if (treeElement instanceof ResourceBundlePropertyStructureViewElement) {
        return ((ResourceBundlePropertyStructureViewElement)treeElement).getProperties()[0];
      }
      return null;
    }
  });
  return elements.toArray(new IProperty[elements.size()]);
}
项目:intellij-ce-playground    文件:XmlPropertiesFileImpl.java   
private void ensurePropertiesLoaded() {
  while (myFileModificationStamp != myFile.getModificationStamp() || myPropertiesMap == null) {
    myFileModificationStamp = myFile.getModificationStamp();
    MostlySingularMultiMap<String,IProperty> propertiesMap = new MostlySingularMultiMap<String,IProperty>();
    XmlTag roottag = myFile.getRoottag();
    final List<IProperty> propertiesOrder = new ArrayList<IProperty>();
    if (roottag != null) {
      XmlTag[] entries = roottag.findSubTags("entry");
      for (XmlTag entry : entries) {
        XmlProperty property = new XmlProperty(entry,this);
        propertiesOrder.add(property);
        propertiesMap.add(property.getKey(),property);
      }
    }
    final boolean isAlphaSorted = PropertiesImplUtil.isAlphaSorted(propertiesOrder);
    myAlphaSorted = isAlphaSorted;
    myProperties = propertiesOrder;
    myPropertiesMap = propertiesMap;
  }
}
项目:intellij-ce-playground    文件:PropertyReferenceBase.java   
@NotNull
public ResolveResult[] multiResolve(final boolean incompleteCode) {
  final String key = getKeyText();

  List<IProperty> properties;
  final List<PropertiesFile> propertiesFiles = getPropertiesFiles();
  if (propertiesFiles == null) {
    properties = PropertiesImplUtil.findPropertiesByKey(getElement().getProject(),key);
  }
  else {
    properties = new ArrayList<IProperty>();
    for (PropertiesFile propertiesFile : propertiesFiles) {
      properties.addAll(propertiesFile.findPropertiesByKey(key));
    }
  }
  // put default properties file first
  ContainerUtil.quickSort(properties,new Comparator<IProperty>() {
    public int compare(final IProperty o1,final IProperty o2) {
      String name1 = o1.getPropertiesFile().getName();
      String name2 = o2.getPropertiesFile().getName();
      return Comparing.compare(name1,name2);
    }
  });
  return getResolveResults(properties);
}
项目:intellij-ce-playground    文件:ResourceBundleFileStructureViewElement.java   
public static MultiMap<String,IProperty> getPropertiesMap(ResourceBundle resourceBundle,boolean onlyIncomplete) {
  List<PropertiesFile> propertiesFiles = resourceBundle.getPropertiesFiles();
  final MultiMap<String,IProperty> propertyNames;
  if (onlyIncomplete) {
    propertyNames = getChildrenIdShowOnlyIncomplete(resourceBundle);
  } else {
    propertyNames = MultiMap.createLinked();
    for (PropertiesFile propertiesFile : propertiesFiles) {
      List<IProperty> properties = propertiesFile.getProperties();
      for (IProperty property : properties) {
        String name = property.getKey();
        propertyNames.putValue(name,property);
      }
    }
  }
  return propertyNames;
}
项目:intellij-ce-playground    文件:GroovyExtensionProvider.java   
public Couple<List<String>> collectExtensions(GlobalSearchScope resolveScope) {
  PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage("meta-inf.services");
  if (aPackage == null) {
    return Couple.of(Collections.<String>emptyList(),Collections.<String>emptyList());
  }


  List<String> instanceClasses = new ArrayList<String>();
  List<String> staticclasses = new ArrayList<String>();
  for (PsiDirectory directory : aPackage.getDirectories(resolveScope)) {
    PsiFile file = directory.findFile(ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE);
    if (file instanceof PropertiesFile) {
      IProperty inst = ((PropertiesFile)file).findPropertyByKey("extensionClasses");
      IProperty stat = ((PropertiesFile)file).findPropertyByKey("staticExtensionClasses");

      if (inst != null) collectClasses(inst,instanceClasses);
      if (stat != null) collectClasses(stat,staticclasses);
    }
  }

  return Couple.of(instanceClasses,staticclasses);
}
项目:hybris-integration-intellij-idea-plugin    文件:JspPropertyFoldingBuilder.java   
@Override
public String getPlaceholderText(@NotNull ASTNode node) {
    final PsiElement element = node.getPsi();
    if (element instanceof XmlAttributeValue) {
        IProperty property = getResolvedProperty((XmlAttributeValue) element);
        return property == null ? element.getText() : "{" + property.getValue() + "}";
    }
    return element.getText();
}
项目:hybris-integration-intellij-idea-plugin    文件:JspPropertyFoldingBuilder.java   
private static Locale safeGetLocale(final @NotNull IProperty property) {
    try {
        PropertiesFile file = property.getPropertiesFile();
        return file == null ? null : file.getLocale();
    } catch (PsiInvalidElementAccessException e) {
        return null;
    }
}
项目:mule-intellij-plugins    文件:DecryptPropertyAction.java   
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    final Project project = (Project) anActionEvent.getData(CommonDataKeys.PROJECT);

    PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);

    IProperty selectedProperty = getSelectedProperty(anActionEvent.getDataContext());

    final EncryptDialog form = new EncryptDialog();
    form.setTitle("Decrypt Property: " + selectedProperty.getKey());
    form.show();
    boolean isOk = form.getExitCode() == DialogWrapper.OK_EXIT_CODE;

    logger.debug("**** ALGORITHM " + form.getAlgorithm().getSelectedItem());
    logger.debug("**** MODE " + form.getMode().getSelectedItem());

    if (isOk) {
        new WriteCommandAction.Simple(project,psiFile) {
            @Override
            protected void run() throws Throwable {
                EncryptionAlgorithm algorithm = (EncryptionAlgorithm) form.getAlgorithm().getSelectedItem();
                EncryptionMode mode = (EncryptionMode) form.getMode().getSelectedItem();

                try {
                    String originalValue = selectedProperty.getValue();
                    String encryptedProperty = originalValue.substring(2,originalValue.length() - 1);

                    byte[] decryptedBytes = algorithm.getBuilder().forKey(form.getEncryptionKey().getText()).using(mode)
                            .build().decrypt(Base64.decode(encryptedProperty));

                    selectedProperty.setValue(new String(decryptedBytes));
                } catch (Exception e) {
                    Notification notification = MuleUIUtils.MULE_NOTIFICATION_GROUP.createNotification("Unable to decrypt property","Property '" + selectedProperty.getKey() + "' cannot be decrypted : " + e,NotificationType.ERROR,null);
                    Notifications.Bus.notify(notification,project);
                }
            }
        }.execute();
    }
}
项目:mule-intellij-plugins    文件:EncryptPropertyAction.java   
@Override
    public void actionPerformed(AnActionEvent anActionEvent)
    {
        final Project project = (Project)anActionEvent.getData(CommonDataKeys.PROJECT);

        PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);

        IProperty selectedProperty = getSelectedProperty(anActionEvent.getDataContext());
        if (selectedProperty == null)
            return;

        final EncryptDialog form = new EncryptDialog();
        form.setTitle("Encrypt Property: " + selectedProperty.getKey());
        form.show();
        boolean isOk = form.getExitCode() == DialogWrapper.OK_EXIT_CODE;

//        System.out.println("******** IS OK " + isOk);
        logger.debug("**** ALGORITHM " + form.getAlgorithm().getSelectedItem());
        logger.debug("**** MODE " + form.getMode().getSelectedItem());

        if (isOk) {
            new WriteCommandAction.Simple(project,psiFile) {
                @Override
                protected void run() throws Throwable {
                    EncryptionAlgorithm algorithm = (EncryptionAlgorithm) form.getAlgorithm().getSelectedItem();
                    EncryptionMode mode = (EncryptionMode) form.getMode().getSelectedItem();

                    byte[] encryptedBytes = algorithm.getBuilder().forKey(form.getEncryptionKey().getText()).using(mode)
                            .build().encrypt(selectedProperty.getValue().getBytes());
                    StringBuilder result = new StringBuilder();
                    result.append(ENCRYPT_PREFIX);
                    result.append(new String(Base64.encode(encryptedBytes)));
                    result.append(ENCRYPT_SUFFIX);
                    selectedProperty.setValue(result.toString());
                }
            }.execute();
        }
    }
项目:intellij-ce-playground    文件:FindManagerTest.java   
private void searchProperty(String query) {
  FindModel findModel = new FindModel();
  findModel.setStringToFind(query);
  findModel.setWholeWordsOnly(true);
  findModel.setFromCursor(false);
  findModel.setGlobal(true);
  findModel.setMultipleFiles(true);
  findModel.setProjectScope(true);
  findModel.setDirectoryName(mySourceDirs[0].getPath());
  findModel.setWithSubdirectories(true);

  List<UsageInfo> usages = findUsages(findModel);
  assertEquals(2,usages.size());
  if (!(usages.get(0).getFile() instanceof PsiJavaFile)) {
    Collections.swap(usages,1);
  }

  PsiElement refElement = getParentFromUsage(usages.get(0));
  assertTrue(refElement instanceof PsiLiteralExpression);
  assertEquals("xx.yy",((PsiLiteralExpression)refElement).getValue());

  VirtualFile file = mySourceDirs[0].findFileByRelativePath("x/dd.properties");
  assertNotNull(file);
  PropertiesFile propertiesFile = (PropertiesFile)PsiManager.getInstance(myProject).findFile(file);
  assertNotNull(propertiesFile);
  refElement = getParentFromUsage(usages.get(1));
  assertTrue(refElement instanceof IProperty);
  assertSame(propertiesFile.findPropertyByKey("xx.yy"),refElement);
}
项目:intellij-ce-playground    文件:GradleImplicitPropertyUsageProviderTest.java   
public void testGradleWrapper() {
  VirtualFile vFile = myFixture.copyFiletoProject("projects/projectWithAppandLib/gradle/wrapper/gradle-wrapper.properties","gradle/wrapper/gradle-wrapper.properties");
  PsiFile file = PsiManager.getInstance(getProject()).findFile(vFile);
  assertNotNull(file);
  PropertiesFile propertiesFile = (PropertiesFile)file;
  GradleImplicitPropertyUsageProvider provider = new GradleImplicitPropertyUsageProvider();
  for (IProperty property : propertiesFile.getProperties()) {
    // All properties are considered used in this file
    String name = property.getName();
    assertTrue(name,provider.isUsed((Property)property));
  }
}
项目:intellij-ce-playground    文件:MavenPropertyPsiReference.java   
protected static void collectPropertiesFileVariants(@Nullable PropertiesFile file,@Nullable String prefix,List<Object> result,Set<String> variants) {
  if (file == null) return;

  for (IProperty each : file.getProperties()) {
    String name = each.getKey();
    if (name != null) {
      if (prefix != null) name = prefix + name;

      if (variants.add(name)) {
        result.add(createLookupElement(each,name,PlatformIcons.PROPERTY_ICON));
      }
    }
  }
}
项目:intellij-ce-playground    文件:MavenFilteredPropertyPsiReference.java   
@Override
protected PsiElement doResolve() {
  PsiElement result = super.doResolve();
  if (result != null) return result;

  for (String each : myMavenProject.getFilterPropertiesFiles()) {
    VirtualFile file = LocalFileSystem.getInstance().findFileByPath(each);
    if (file == null) continue;
    IProperty property = MavendomUtil.findProperty(myProject,file,myText);
    if (property != null) return property.getPsiElement();
  }

  return null;
}
项目:intellij-ce-playground    文件:MavenPropertyCompletionAndResolutionTest.java   
public void testUpperCaseEnvPropertiesOnWindows() throws Exception {
  if (!SystemInfo.isWindows) return;

  createProjectPom("<groupId>test</groupId>" +
                   "<artifactId>project</artifactId>" +
                   "<version>1</version>" +

                   "<name>${<caret>env.PATH}</name>");

  PsiReference ref = getReferenceAtCaret(myProjectPom);
  assertNotNull(ref);

  PsiElement resolved = ref.resolve();
  assertEquals(System.getenv("Path").replaceAll("[^A-Za-z]",""),((IProperty)resolved).getValue().replaceAll("[^A-Za-z]",""));
}
项目:intellij-ce-playground    文件:AntDomProperty.java   
public PsiElement getNavigationElement(final String propertyName) {
  DomTarget domTarget = DomTarget.getTarget(this);
  if (domTarget == null) {
    final GenericAttributeValue<String> environment = getEnvironment();
    if (environment.getRawText() != null) {
      domTarget = DomTarget.getTarget(this,environment);
    }
    if (domTarget == null) {
      final GenericAttributeValue<String> resource = getResource();
      if (resource.getRawText() != null) {
        domTarget = DomTarget.getTarget(this,resource);
      }
    }
  }

  if (domTarget != null) {
    final PsiElement psi = PomService.convertToPsi(domTarget);
    if (psi != null) {
      return psi;
    }
  }

  final PsiFileSystemItem psiFile = getFile().getValue();
  if (psiFile != null) {
    final String prefix = getPropertyPrefixValue();
    String _propertyName = propertyName;
    if (prefix != null) {
      if (!propertyName.startsWith(prefix)) {
        return null;
      }
      _propertyName = propertyName.substring(prefix.length());
    }
    final PropertiesFile pf = toPropertiesFile(psiFile);
    if (pf != null) {
      final IProperty property = pf.findPropertyByKey(_propertyName);
      return property != null? property.getPsiElement() : null;
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:ResourceBundleKeyReference.java   
public PsiElement bindtoElement(@NotNull final PsiElement element) throws IncorrectOperationException {
  if (!(element instanceof IProperty)) {
    throw new IncorrectOperationException();
  }
  updaterangeText(((IProperty)element).getUnescapedKey());
  return myFile;
}
项目:intellij-ce-playground    文件:ResourceBundleKeyReference.java   
public boolean isReferenceto(final PsiElement element) {
  if (!(element instanceof IProperty)) {
    return false;
  }
  IProperty property = (IProperty) element;
  String baseName = ResourceBundleManager.getInstance(element.getProject()).getFullName(property.getPropertiesFile());
  return baseName != null && myBundleName.equals(baseName.replace('.','/')) && getRangeText().equals(property.getUnescapedKey());
}
项目:intellij-ce-playground    文件:KeyChooserDialog.java   
private void fillPropertyList() {
  myPairs = new ArrayList<Couple<String>>();

  final List<IProperty> properties = myBundle.getProperties();
  for (IProperty property : properties) {
    final String key = property.getUnescapedKey();
    final String value = property.getValue();
    if (key != null) {
      myPairs.add(Couple.of(key,value != null ? value : NULL));
    }
  }
  Collections.sort(myPairs,new MyPairComparator());
}
项目:intellij-ce-playground    文件:PropertiesCompletionContributor.java   
@Override
public void renderElement(LookupElement element,LookupElementPresentation presentation) {
  IProperty property = (IProperty)element.getobject();
  presentation.setIcon(PlatformIcons.PROPERTY_ICON);
  String key = StringUtil.notNullize(property.getUnescapedKey());
  presentation.setItemText(key);

  PropertiesFile propertiesFile = property.getPropertiesFile();
  ResourceBundle resourceBundle = propertiesFile.getResourceBundle();
  String value = property.getValue();
  boolean hasBundle = resourceBundle != EmptyResourceBundle.getInstance();
  if (hasBundle) {
    PropertiesFile defaultPropertiesFile = resourceBundle.getDefaultPropertiesFile();
    IProperty defaultProperty = defaultPropertiesFile.findPropertyByKey(key);
    if (defaultProperty != null) {
      value = defaultProperty.getValue();
    }
  }

  if (hasBundle) {
    presentation.setTypeText(resourceBundle.getBaseName(),AllIcons.FileTypes.Properties);
  }

  if (presentation instanceof RealLookupElementPresentation && value != null) {
    value = "=" + value;
    int limit = 1000;
    if (value.length() > limit || !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value,false)) {
      if (value.length() > limit) {
        value = value.substring(0,limit);
      }
      while (value.length() > 0 && !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value + "...",false)) {
        value = value.substring(0,value.length() - 1);
      }
      value += "...";
    }
  }

  TextAttributes attrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_VALUE);
  presentation.setTailText(value,attrs.getForegroundColor());
}
项目:intellij-ce-playground    文件:PropertiesCompletionContributor.java   
public static LookupElement[] getvariants(Set<Object> variants) {
  List<LookupElement> elements = ContainerUtil.mapNotNull(variants,new NullableFunction<Object,LookupElement>() {
    @Override
    public LookupElement fun(Object o) {
      if (o instanceof String) return LookupElementBuilder.create((String)o).withIcon(PlatformIcons.PROPERTY_ICON);
      return createVariant((IProperty)o);
    }
  });
  return elements.toArray(new LookupElement[elements.size()]);
}
项目:intellij-ce-playground    文件:I18nizeQuickFixDialog.java   
private String suggestSelectedFileUrl(List<String> paths) {
  if (myDefaultPropertyValue != null) {
    for (String path : paths) {
      VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(path));
      if (file == null) continue;
      PsiFile psiFile = myContext.getManager().findFile(file);
      if (!(psiFile instanceof PropertiesFile)) continue;
      for (IProperty property : ((PropertiesFile)psiFile).getProperties()) {
        if (property.getValue().equals(myDefaultPropertyValue)) return path;
      }
    }
  }
  return LastSelectedPropertiesFileStore.getInstance().suggestLastSelectedPropertiesFileUrl(myContext);
}

com.intellij.lang.properties.parsing.PropertiesElementTypes的实例源码

com.intellij.lang.properties.parsing.PropertiesElementTypes的实例源码

项目:intellij-ce-playground    文件:PropertiesFileImpl.java   
private void ensurePropertiesLoaded() {
  if (myPropertiesMap != null) return;

  final ASTNode[] props = getPropertiesList().getChildren(PropertiesElementTypes.PROPERTIES);
  MostlySingularMultiMap<String,IProperty> propertiesMap = new MostlySingularMultiMap<String,IProperty>();
  List<IProperty> properties = new ArrayList<IProperty>(props.length);
  for (final ASTNode prop : props) {
    final Property property = (Property)prop.getPsi();
    String key = property.getUnescapedKey();
    propertiesMap.add(key,property);
    properties.add(property);
  }
  final boolean isAlphaSorted = PropertiesImplUtil.isAlphaSorted(properties);
  synchronized (lock) {
    if (myPropertiesMap != null) return;
    myProperties = properties;
    myPropertiesMap = propertiesMap;
    myAlphaSorted = isAlphaSorted;
  }
}
项目:tools-idea    文件:PropertiesFileImpl.java   
private void ensurePropertiesLoaded() {
  if (myPropertiesMap != null) return;

  final ASTNode[] props = getPropertiesList().getChildren(PropertiesElementTypes.PROPERTIES);
  MostlySingularMultiMap<String,property);
    properties.add(property);
  }
  synchronized (lock) {
    if (myPropertiesMap != null) return;
    myProperties = properties;
    myPropertiesMap = propertiesMap;
  }
}
项目:intellij-ce-playground    文件:PropertiescoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(PropertiesFileType.INSTANCE,"properties");
  appEnvironment.addExplicitExtension(SyntaxHighlighterFactory.LANGUAGE_FACTORY,PropertiesLanguage.INSTANCE,new PropertiesSyntaxHighlighterFactory());
  appEnvironment.addExplicitExtension(LanguageParserDeFinitions.INSTANCE,new PropertiesParserDeFinition());
  appEnvironment.addExtension(FileBasedindexExtension.EXTENSION_POINT_NAME,new XmlPropertiesIndex());
  appEnvironment.addExtension(StubIndexExtension.EP_NAME,new PropertyKeyIndex());

  appEnvironment.registerapplicationservice(PropertiesQuickFixFactory.class,new EmptyPropertiesQuickFixFactory());
  appEnvironment.registerapplicationservice(PropertiesRefactoringSettings.class,new PropertiesRefactoringSettings());
  appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE,new PropertiesAnnotator());
  appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE,new PropertiesFindUsagesProvider());

  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE,new PropertiesASTFactory());
  appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE,new PropertiesFoldingBuilder());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE,PropertyImpl.class,new PropertyManipulator());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE,PropertyKeyImpl.class,new PropertyKeyManipulator());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE,PropertyValueImpl.class,new PropertyValueManipulator());

  final StubElementTypeHolderEP stubElementTypeHolderBean = new StubElementTypeHolderEP();
  stubElementTypeHolderBean.holderClass = PropertiesElementTypes.class.getName();
  appEnvironment.addExtension(StubElementTypeHolderEP.EP_NAME,stubElementTypeHolderBean);

  appEnvironment.addExplicitExtension(LanguageCommenters.INSTANCE,new PropertiesCommenter());
  appEnvironment.addExplicitExtension(Idindexers.INSTANCE,PropertiesFileType.INSTANCE,new PropertiesIdindexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE,new PropertiesTodoIndexer());

  appEnvironment.addExtension(IconProvider.EXTENSION_POINT_NAME,new XmlPropertiesIconProvider());
}
项目:intellij-ce-playground    文件:PropertiesWordCompletionFilter.java   
public boolean isWordCompletionEnabledIn(final IElementType element) {
  return super.isWordCompletionEnabledIn(element) || element == PropertiesElementTypes.PROPERTY;
}
项目:intellij-ce-playground    文件:PropertyStubElementType.java   
public PropertyStubElementType() {
  super("PROPERTY",PropertiesElementTypes.LANG);
}
项目:intellij-ce-playground    文件:PropertiesListStubImpl.java   
public PropertiesListStubImpl(final StubElement parent) {
  super(parent,PropertiesElementTypes.PROPERTIES_LIST);
}
项目:intellij-ce-playground    文件:PropertyStubImpl.java   
public PropertyStubImpl(final StubElement parent,final String key) {
  super(parent,PropertiesElementTypes.PROPERTY);
  myKey = key;
}
项目:intellij-ce-playground    文件:PropertiesListImpl.java   
public PropertiesListImpl(final PropertiesListStub stub) {
  super(stub,PropertiesElementTypes.PROPERTIES_LIST);
}
项目:intellij-ce-playground    文件:PropertiesFoldingBuilder.java   
@Override
protected boolean isCustomFoldingRoot(ASTNode node) {
  return node.getElementType() == PropertiesElementTypes.FILE;
}
项目:tools-idea    文件:PropertiesWordCompletionFilter.java   
public boolean isWordCompletionEnabledIn(final IElementType element) {
  return super.isWordCompletionEnabledIn(element) || element == PropertiesElementTypes.PROPERTY;
}
项目:tools-idea    文件:PropertiesListStubImpl.java   
public PropertiesListStubImpl(final StubElement parent) {
  super(parent,PropertiesElementTypes.PROPERTIES_LIST);
}
项目:tools-idea    文件:PropertyStubImpl.java   
public PropertyStubImpl(final StubElement parent,PropertiesElementTypes.PROPERTY);
  myKey = key;
}
项目:tools-idea    文件:PropertiesListImpl.java   
public PropertiesListImpl(final PropertiesListStub stub) {
  super(stub,PropertiesElementTypes.PROPERTIES_LIST);
}
项目:tools-idea    文件:PropertiesFoldingBuilder.java   
@Override
protected boolean isCustomFoldingRoot(ASTNode node) {
  return node.getElementType() == PropertiesElementTypes.FILE;
}

com.intellij.lang.properties.parsing.PropertiesTokenTypes的实例源码

com.intellij.lang.properties.parsing.PropertiesTokenTypes的实例源码

项目:intellij-ce-playground    文件:PropertiesASTFactory.java   
@Override
@Nullable
public LeafElement createLeaf(@NotNull final IElementType type,@NotNull CharSequence text) {
  if (type == PropertiesTokenTypes.KEY_CHaraCTERS) {
    return new PropertyKeyImpl(type,text);
  }

  if (type == PropertiesTokenTypes.VALUE_CHaraCTERS) {
    return new PropertyValueImpl(type,text);
  }

  if (type == PropertiesTokenTypes.END_OF_LINE_COMMENT) {
    return new PsiCommentImpl(type,text);
  }

  return new LeafPsiElement(type,text);
}
项目:intellij-ce-playground    文件:PropertyImpl.java   
@Nullable
public Character getkeyvalueDelimiter() {
  final PsiElement delimiter = findChildByType(PropertiesTokenTypes.KEY_VALUE_SEParaTOR);
  if (delimiter == null) {
    return null;
  }
  String separatorText = delimiter.getText();
  if (separatorText.isEmpty()) {
    return null;
  }
  separatorText = separatorText.trim();
  if (separatorText.isEmpty()) {
    separatorText = " ";
  }
  LOG.assertTrue(separatorText.length() == 1,"\"" + separatorText + "\"");
  return separatorText.charat(0);
}
项目:intellij-ce-playground    文件:PropertiesFilterLexer.java   
public void advance() {
  final IElementType tokenType = getDelegate().getTokenType();

  if (tokenType == PropertiesTokenTypes.KEY_CHaraCTERS) {
    scanWordsInToken(UsageSearchContext.IN_CODE | UsageSearchContext.IN_FOREIGN_LANGUAGES | UsageSearchContext.IN_PLAIN_TEXT,false,false);
  }
  else if (PropertiesTokenTypes.COMMENTS.contains(tokenType)) {
    scanWordsInToken(UsageSearchContext.IN_COMMENTS | UsageSearchContext.IN_PLAIN_TEXT,false);
    advancetodoItemCountsInToken();
  }
  else {
    scanWordsInToken(UsageSearchContext.IN_CODE | UsageSearchContext.IN_FOREIGN_LANGUAGES | UsageSearchContext.IN_PLAIN_TEXT,false);
  }

  getDelegate().advance();
}
项目:tools-idea    文件:PropertiesFilterLexer.java   
public void advance() {
  final IElementType tokenType = getDelegate().getTokenType();

  if (tokenType == PropertiesTokenTypes.KEY_CHaraCTERS) {
    scanWordsInToken(UsageSearchContext.IN_CODE | UsageSearchContext.IN_FOREIGN_LANGUAGES | UsageSearchContext.IN_PLAIN_TEXT,false);
  }

  getDelegate().advance();
}
项目:intellij-ce-playground    文件:EnterInPropertiesFileHandler.java   
private static void handleEnterInPropertiesFile(final Editor editor,final Document document,final PsiElement psiAtOffset,int caretoffset) {
  String text = document.getText();
  String line = text.substring(0,caretoffset);
  int i = line.lastIndexOf('\n');
  if (i > 0) {
    line = line.substring(i);
  }
  final String toInsert;
  if (PropertiesUtil.isUnescapedBackSlashAtTheEnd(line)) {
    toInsert = "\n  ";
  }
  else {
    final IElementType elementType = psiAtOffset == null ? null : psiAtOffset.getNode().getElementType();

    if (elementType == PropertiesTokenTypes.VALUE_CHaraCTERS) {
      toInsert = "\\\n  ";
    }
    else if (elementType == PropertiesTokenTypes.END_OF_LINE_COMMENT && "#!".indexOf(document.getText().charat(caretoffset)) == -1) {
      toInsert = "\n#";
    }
    else {
      toInsert = "\n";
    }
  }
  document.insertString(caretoffset,toInsert);
  caretoffset+=toInsert.length();
  editor.getCaretModel().movetoOffset(caretoffset);
  editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
  editor.getSelectionModel().removeSelection();
}
项目:intellij-ce-playground    文件:PropertyImpl.java   
public void replacekeyvalueDelimiterWithDefault() {
  PropertyImpl property = (PropertyImpl)PropertiesElementFactory.createProperty(getProject(),"yyy","xxx");
  final ASTNode oldDelimiter = getNode().findChildByType(PropertiesTokenTypes.KEY_VALUE_SEParaTOR);
  LOG.assertTrue(oldDelimiter != null);
  final ASTNode newDelimiter = property.getNode().findChildByType(PropertiesTokenTypes.KEY_VALUE_SEParaTOR);
  LOG.assertTrue(newDelimiter != null);
  getNode().replaceChild(oldDelimiter,newDelimiter);
}
项目:intellij-ce-playground    文件:PropertiesHighlightingLexer.java   
public PropertiesHighlightingLexer() {
  super(new PropertiesLexer());
  registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR,PropertiesTokenTypes.VALUE_CHaraCTERS,true,"#!=:"),new IElementType[]{PropertiesTokenTypes.VALUE_CHaraCTERS},IElementType.EMPTY_ARRAY);
  registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR,PropertiesTokenTypes.KEY_CHaraCTERS,"#!=: "),new IElementType[]{PropertiesTokenTypes.KEY_CHaraCTERS},IElementType.EMPTY_ARRAY);
}
项目:intellij-ce-playground    文件:DGMReferenceContributor.java   
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.VALUE_CHaraCTERS),new PsiReferenceProvider() {
    @NotNull
    @Override
    public PsiReference[] getReferencesByElement(@NotNull PsiElement element,@NotNull ProcessingContext context) {
      if (!DGMUtil.isInDGMFile(element)) return PsiReference.EMPTY_ARRAY;

      IProperty parent = (IProperty)element.getParent();
      if (!"extensionClasses".equals(parent.getName())) {
        return PsiReference.EMPTY_ARRAY;
      }

      ArrayList<PsiReference> result = new ArrayList<PsiReference>();

      String text = element.getText();

      int i = 0;
      while ((i = skipwhiteSpace(i,text)) < text.length()) {
        int end = findWhiteSpaceOrComma(i,text);
        if (end <= text.length()) {
          JavaClassReferenceSet set = new JavaClassReferenceSet(text.substring(i,end),element,i,myProvider);
          ContainerUtil.addAll(result,set.getAllReferences());
        }
        i = end;
        i = skipwhiteSpace(i,text);
        if (i == text.length()) break;
        if (text.charat(i) == ',') i++;
        i = skipwhiteSpace(i,text);
      }

      return result.toArray(new PsiReference[result.size()]);
    }
  });
}
项目:IntelliJ_Jahia_plugin    文件:CndReferenceContributor.java   
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
    CndReferenceProvider cndReferenceProvider = new CndReferenceProvider();
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class),cndReferenceProvider);  //Java

    registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUPER_TYPE),cndReferenceProvider);  //Cnd super types
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.EXTENSION),cndReferenceProvider);  //Cnd extends types
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUB_NODE_TYPE),cndReferenceProvider);  //Cnd subnode types
    registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUB_NODE_DEFAULT_TYPE),cndReferenceProvider);  //Cnd subnode default type

    registrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlElementType.XML_ATTRIBUTE_VALUE),cndReferenceProvider);  //XML

    registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.KEY_CHaraCTERS),cndReferenceProvider);  //Properties
}
项目:tools-idea    文件:EnterInPropertiesFileHandler.java   
private static void handleEnterInPropertiesFile(final Editor editor,toInsert);
  caretoffset+=toInsert.length();
  editor.getCaretModel().movetoOffset(caretoffset);
  editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
  editor.getSelectionModel().removeSelection();
}
项目:tools-idea    文件:PropertiesHighlightingLexer.java   
public PropertiesHighlightingLexer() {
  super(new PropertiesLexer());
  registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR,IElementType.EMPTY_ARRAY);
}
项目:tools-idea    文件:PropertiesASTFactory.java   
@Nullable
public LeafElement createLeaf(final IElementType type,CharSequence text) {
  if (type == PropertiesTokenTypes.VALUE_CHaraCTERS) {
    return new PropertyValueImpl(type,text);
}
项目:tools-idea    文件:DGMReferenceContributor.java   
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
  registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.VALUE_CHaraCTERS),text);
      }

      return result.toArray(new PsiReference[result.size()]);
    }
  });
}
项目:intellij-ce-playground    文件:PropertyImpl.java   
@Nullable
public ASTNode getKeyNode() {
  return getNode().findChildByType(PropertiesTokenTypes.KEY_CHaraCTERS);
}
项目:intellij-ce-playground    文件:PropertyImpl.java   
@Nullable
public ASTNode getValueNode() {
  return getNode().findChildByType(PropertiesTokenTypes.VALUE_CHaraCTERS);
}
项目:intellij-ce-playground    文件:PropertiesValueHighlightingLexer.java   
public PropertiesValueHighlightingLexer() {
    super(new DummyLexer(PropertiesTokenTypes.VALUE_CHaraCTERS));

    registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR,IElementType.EMPTY_ARRAY);
}
项目:tools-idea    文件:PropertyImpl.java   
@Nullable
public ASTNode getKeyNode() {
  return getNode().findChildByType(PropertiesTokenTypes.KEY_CHaraCTERS);
}
项目:tools-idea    文件:PropertyImpl.java   
@Nullable
public ASTNode getValueNode() {
  return getNode().findChildByType(PropertiesTokenTypes.VALUE_CHaraCTERS);
}
项目:tools-idea    文件:PropertiesValueHighlightingLexer.java   
public PropertiesValueHighlightingLexer() {
    super(new DummyLexer(PropertiesTokenTypes.VALUE_CHaraCTERS));

    registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR,IElementType.EMPTY_ARRAY);
}

关于com.intellij.lang.properties.psi.impl.PropertyStubImpl的实例源码comparable源码的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于com.hazelcast.config.properties.SimplePropertyDefinition的实例源码、com.intellij.lang.properties.IProperty的实例源码、com.intellij.lang.properties.parsing.PropertiesElementTypes的实例源码、com.intellij.lang.properties.parsing.PropertiesTokenTypes的实例源码等相关知识的信息别忘了在本站进行查找喔。

本文标签: