当前位置: 首页>>代码示例>>Java>>正文


Java PsiNameHelper.getInstance方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiNameHelper.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java PsiNameHelper.getInstance方法的具体用法?Java PsiNameHelper.getInstance怎么用?Java PsiNameHelper.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiNameHelper的用法示例。


在下文中一共展示了PsiNameHelper.getInstance方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _commit

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
public void _commit(boolean finishChosen) throws CommitStepException {
  // Stop editing if any
  final TableCellEditor cellEditor = myTable.getCellEditor();
  if(cellEditor != null){
    cellEditor.stopCellEditing();
  }

  // Check that all included fields are bound to valid bean properties
  final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myData.myProject);
  for(int i = 0; i <myData.myBindings.length; i++){
    final FormProperty2BeanProperty binding = myData.myBindings[i];
    if(binding.myBeanProperty == null){
      continue;
    }

    if (!nameHelper.isIdentifier(binding.myBeanProperty.myName)){
      throw new CommitStepException(
        UIDesignerBundle.message("error.X.is.not.a.valid.property.name", binding.myBeanProperty.myName)
      );
    }
  }

  myData.myGenerateIsModified = myChkIsModified.isSelected();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:BindToNewBeanStep.java

示例2: hasAcceptablePackage

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
private boolean hasAcceptablePackage(@NotNull VirtualFile vFile)
{
	if(vFile.getFileType() == JavaClassFileType.INSTANCE)
	{
		// See IDEADEV-5626
		final VirtualFile root = ProjectRootManager.getInstance(myManager.getProject()).getFileIndex().getClassRootForFile(vFile);
		VirtualFile parent = vFile.getParent();
		final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myManager.getProject());
		while(parent != null && !Comparing.equal(parent, root))
		{
			if(!nameHelper.isIdentifier(parent.getName()))
			{
				return false;
			}
			parent = parent.getParent();
		}
	}

	return true;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:JavaFileManagerImpl.java

示例3: canRun

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Override
protected void canRun() throws ConfigurationException {
  final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myProject);
  for (ParameterData parameterData : myParametersMap.values()) {
    if (!nameHelper.isIdentifier(parameterData.getFieldName())) throw new ConfigurationException("\'" + parameterData.getFieldName() + "\' is not a valid field name");
    if (!nameHelper.isIdentifier(parameterData.getSetterName())) throw new ConfigurationException("\'" + parameterData.getSetterName() + "\' is not a valid setter name");
  }
  if (myCreateBuilderClassRadioButton.isSelected()) {
    final String className = myNewClassName.getText().trim();
    if (className.length() == 0 || !nameHelper.isQualifiedName(className)) throw new ConfigurationException("\'" + className + "\' is invalid builder class name");
    final String packageName = myPackageTextField.getText().trim();
    if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName)) throw new ConfigurationException("\'" + packageName + "\' is invalid builder package name");
  } else {
    final String qualifiedName = myExistentClassTF.getText().trim();
    if (qualifiedName.length() == 0 || !nameHelper.isQualifiedName(qualifiedName)) throw new ConfigurationException("\'" + qualifiedName + "\' is invalid builder qualified class name");
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:ReplaceConstructorWithBuilderDialog.java

示例4: setUp

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    final Project project = getProject();
    final Json2JavaBundle bundle = Json2JavaBundle.getInstance();
    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);
    underTest = new ClassSuffixValidator(bundle, nameHelper);
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:10,代码来源:ClassSuffixValidatorTest.java

示例5: setUp

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    final Project project = getProject();
    final Json2JavaBundle bundle = Json2JavaBundle.getInstance();
    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);
    underTest = new ClassPrefixValidator(bundle, nameHelper);
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:10,代码来源:ClassPrefixValidatorTest.java

示例6: setUp

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Before
@Override
public void setUp() throws Exception {
    super.setUp();
    final Project project = getProject();
    nameHelper = PsiNameHelper.getInstance(project);
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:8,代码来源:ClassNamePolicyTest.java

示例7: validateBuilderClassName

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
private boolean validateBuilderClassName(@NotNull String builderClassName, @NotNull Project project, @NotNull ProblemBuilder builder) {
  final PsiNameHelper psiNameHelper = PsiNameHelper.getInstance(project);
  if (!psiNameHelper.isIdentifier(builderClassName)) {
    builder.addError("%s is not a valid identifier", builderClassName);
    return false;
  }
  return true;
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:9,代码来源:BuilderHandler.java

示例8: checkCreateClassOrInterface

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
public static void checkCreateClassOrInterface(@NotNull PsiDirectory directory, String name) throws IncorrectOperationException
{
	PsiUtil.checkIsIdentifier(directory.getManager(), name);

	String fileName = name + "." + JavaFileType.INSTANCE.getDefaultExtension();
	directory.checkCreateFile(fileName);

	PsiNameHelper helper = PsiNameHelper.getInstance(directory.getProject());
	PsiJavaPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
	String qualifiedName = aPackage == null ? null : aPackage.getQualifiedName();
	if(!StringUtil.isEmpty(qualifiedName) && !helper.isQualifiedName(qualifiedName))
	{
		throw new IncorrectOperationException("Cannot create class in invalid package: '" + qualifiedName + "'");
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:16,代码来源:JavaDirectoryServiceImpl.java

示例9: isAvailable

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
private static boolean isAvailable(DataContext dataContext)
{
	final Project project = dataContext.getData(CommonDataKeys.PROJECT);
	final IdeView view = dataContext.getData(LangDataKeys.IDE_VIEW);
	if(project == null || view == null)
	{
		return false;
	}
	final PsiDirectory[] directories = view.getDirectories();
	if(directories.length == 0)
	{
		return false;
	}
	final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
	final JavaDirectoryService directoryService = JavaDirectoryService.getInstance();
	final PsiNameHelper nameHelper = PsiNameHelper.getInstance(project);
	for(PsiDirectory directory : directories)
	{
		if(projectFileIndex.isUnderContentFolderType(directory.getVirtualFile(), ContentFolderScopes.productionAndTest()) && PsiUtil.isLanguageLevel5OrHigher(directory))
		{
			final PsiJavaPackage aPackage = directoryService.getPackage(directory);
			if(aPackage != null)
			{
				final String qualifiedName = aPackage.getQualifiedName();
				if(StringUtil.isEmpty(qualifiedName) || nameHelper.isQualifiedName(qualifiedName))
				{
					return true;
				}
			}
		}

	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:35,代码来源:CreatePackageInfoAction.java

示例10: canRun

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Override
protected void canRun() throws ConfigurationException {
  final String name = myNameField.getEnteredName();
  final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myContainingClass.getProject());
  if (!nameHelper.isIdentifier(name)) {
    throw new ConfigurationException("\'" + name + "\' is invalid factory method name");
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:ReplaceConstructorWithFactoryDialog.java

示例11: doOKAction

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
protected void doOKAction(){
  final String packageName = myTfPackage.getText();
  final String className = getClassName();

  final String[] errorString = new String[1];
  final PsiManager manager = PsiManager.getInstance(myProject);
  final PsiNameHelper nameHelper = PsiNameHelper.getInstance(manager.getProject());
  if (packageName.length() > 0 && !nameHelper.isQualifiedName(packageName)) {
    errorString[0] = RefactoringBundle.message("invalid.target.package.name.specified");
  } else if (className != null && className.isEmpty()) {
    errorString[0] = RefactoringBundle.message("no.class.name.specified");
  } else {
    if (!nameHelper.isIdentifier(className)) {
      errorString[0] = RefactoringMessageUtil.getIncorrectIdentifierMessage(className);
    }
    else if (!myDoClone) {
      try {
        final PackageWrapper targetPackage = new PackageWrapper(manager, packageName);
        myDestination = myDestinationCB.selectDirectory(targetPackage, false);
        if (myDestination == null) return;
      }
      catch (IncorrectOperationException e) {
        errorString[0] = e.getMessage();
      }
    }
    RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName);
  }

  if (errorString[0] != null) {
    if (errorString[0].length() > 0) {
      Messages.showMessageDialog(myProject, errorString[0], RefactoringBundle.message("error.title"), Messages.getErrorIcon());
    }
    myNameField.requestFocusInWindow();
    return;
  }
  super.doOKAction();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:38,代码来源:CopyClassDialog.java

示例12: canRun

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Override
protected void canRun() throws ConfigurationException {
  final String fieldName = getFieldName();
  final PsiNameHelper helper = PsiNameHelper.getInstance(myProject);
  if (!helper.isIdentifier(fieldName)){
    throw new ConfigurationException("\'" + fieldName + "\' is invalid field name for delegation");
  }
  if (myInnerClassNameField != null) {
    final String className = myInnerClassNameField.getEnteredName();
    if (!helper.isIdentifier(className)) {
      throw new ConfigurationException("\'" + className + "\' is invalid inner class name");
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:15,代码来源:InheritanceToDelegationDialog.java

示例13: provideNameHelper

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Nonnull
@Provides
@Singleton
public PsiNameHelper provideNameHelper(@Nonnull Project project) {
    return PsiNameHelper.getInstance(project);
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:7,代码来源:ProjectModule.java

示例14: setUp

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    final Project project = fixture.getProject();
    bundle = spy(new Json2JavaBundle());
    underTest = new NameValidator(bundle, PsiNameHelper.getInstance(project));
}
 
开发者ID:t28hub,项目名称:json2java4idea,代码行数:7,代码来源:NameValidatorTest.java


注:本文中的com.intellij.psi.PsiNameHelper.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。