本文整理汇总了Java中com.intellij.util.text.UniqueNameGenerator类的典型用法代码示例。如果您正苦于以下问题:Java UniqueNameGenerator类的具体用法?Java UniqueNameGenerator怎么用?Java UniqueNameGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UniqueNameGenerator类属于com.intellij.util.text包,在下文中一共展示了UniqueNameGenerator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: saveMaps
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
public void saveMaps() throws IOException{
File dir = getMapDirectory();
if (dir == null) {
return;
}
File[] files = getMapFiles();
@NonNls String[] filePaths = new String[myMaps.size()];
Document[] documents = new Document[myMaps.size()];
UniqueNameGenerator namesProvider = new UniqueNameGenerator();
for(int i = 0; i < myMaps.size(); i++){
MigrationMap map = myMaps.get(i);
filePaths[i] = dir + File.separator + namesProvider.generateUniqueName(FileUtil.sanitizeFileName(map.getName(), false)) + ".xml";
documents[i] = saveMap(map);
}
JDOMUtil.updateFileSet(files, filePaths, documents, CodeStyleSettingsManager.getSettings(null).getLineSeparator());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MigrationMapSet.java
示例2: actionPerformed
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
String name = UniqueNameGenerator.generateUniqueName(myServerType.getPresentableName(), new Condition<String>() {
@Override
public boolean value(String s) {
for (NamedConfigurable<RemoteServer<?>> configurable : getConfiguredServers()) {
if (configurable.getDisplayName().equals(s)) {
return false;
}
}
return true;
}
});
MyNode node = addServerNode(myServersManager.createServer(myServerType, name), true);
selectNodeInTree(node);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RemoteServerListConfigurable.java
示例3: doSetup
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
protected void doSetup(ModifiableModelsProvider modifiableModelsProvider, final Module module) {
final ModifiableFacetModel model = modifiableModelsProvider.getFacetModifiableModel(module);
final String name = UniqueNameGenerator.generateUniqueName(myFacetType.getDefaultFacetName(), new Condition<String>() {
@Override
public boolean value(String s) {
return FacetManager.getInstance(module).findFacet(myFacetType.getId(), s) == null;
}
});
final F facet = FacetManager.getInstance(module).createFacet(myFacetType, name, myConfiguration,
findUnderlyingFacet(module));
model.addFacet(facet);
modifiableModelsProvider.commitFacetModifiableModel(module, model);
final ModifiableRootModel rootModel = modifiableModelsProvider.getModuleModifiableModel(module);
myDetector.setupFacet(facet, rootModel);
modifiableModelsProvider.commitModuleModifiableModel(rootModel);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FacetBasedDetectedFrameworkDescription.java
示例4: checkFileNameIsFree
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@Nonnull
private String checkFileNameIsFree(@Nonnull String subPath, @Nonnull String schemeName) {
for (Named scheme : mySchemes) {
if (scheme instanceof ExternalizableScheme) {
String name = ((ExternalizableScheme)scheme).getExternalInfo().getCurrentFileName();
if (name != null &&
!schemeName.equals(scheme.getName()) &&
subPath.length() == (name.length() + mySchemeExtension.length()) &&
subPath.startsWith(name) &&
subPath.endsWith(mySchemeExtension)) {
return UniqueNameGenerator.generateUniqueName(FileUtil.sanitizeName(schemeName), collectAllFileNames());
}
}
}
return subPath;
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:SchemesManagerImpl.java
示例5: addNewScheme
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@Override
public void addNewScheme(@Nonnull T scheme, boolean replaceExisting) {
int toReplace = -1;
for (int i = 0; i < mySchemes.size(); i++) {
T existingScheme = mySchemes.get(i);
if (existingScheme.getName().equals(scheme.getName())) {
toReplace = i;
break;
}
}
if (toReplace == -1) {
mySchemes.add(scheme);
}
else if (replaceExisting || !(scheme instanceof ExternalizableScheme)) {
mySchemes.set(toReplace, scheme);
}
else {
//noinspection unchecked
renameScheme((ExternalizableScheme)scheme, UniqueNameGenerator.generateUniqueName(scheme.getName(), collectExistingNames(mySchemes)));
mySchemes.add(scheme);
}
schemeAdded(scheme);
checkCurrentScheme(scheme);
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:AbstractSchemesManager.java
示例6: overriddenParameters
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
public static PsiParameter[] overriddenParameters(PsiParameter[] parameters,
@NotNull JVMElementFactory factory,
@NotNull JavaCodeStyleManager codeStyleManager,
@NotNull PsiSubstitutor substitutor,
PsiElement target) {
PsiParameter[] result = new PsiParameter[parameters.length];
UniqueNameGenerator generator = new UniqueNameGenerator();
for (int i = 0; i < parameters.length; i++) {
PsiParameter parameter = parameters[i];
final PsiType parameterType = parameter.getType();
final PsiType substituted = substituteType(substitutor, parameterType, (PsiMethod)parameter.getDeclarationScope());
String paramName = parameter.getName();
boolean isBaseNameGenerated = true;
final boolean isSubstituted = substituted.equals(parameterType);
if (!isSubstituted && isBaseNameGenerated(codeStyleManager, TypeConversionUtil.erasure(parameterType), paramName)) {
isBaseNameGenerated = false;
}
if (paramName == null ||
isBaseNameGenerated && !isSubstituted && isBaseNameGenerated(codeStyleManager, parameterType, paramName) ||
!factory.isValidParameterName(paramName)) {
String[] names = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, null, substituted).names;
if (names.length > 0) {
paramName = generator.generateUniqueName(names[0]);
}
else {
paramName = generator.generateUniqueName("p");
}
}
else if (!generator.value(paramName)) {
paramName = generator.generateUniqueName(paramName);
}
generator.addExistingName(paramName);
result[i] = factory.createParameter(paramName, substituted, target);
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GenerateMembersUtil.java
示例7: getUniqueLibraryName
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
private static String getUniqueLibraryName(final String baseName, final LibraryTable.ModifiableModel model) {
return UniqueNameGenerator.generateUniqueName(baseName, "", "", " (", ")", new Condition<String>() {
@Override
public boolean value(String s) {
return model.getLibraryByName(s) == null;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:LibrariesContainerFactory.java
示例8: splitState
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@Override
public final List<Pair<Element, String>> splitState(@NotNull Element state) {
UniqueNameGenerator generator = new UniqueNameGenerator();
List<Pair<Element, String>> result = new SmartList<Pair<Element, String>>();
for (Iterator<Element> iterator = state.getChildren(getSubStateTagName()).iterator(); iterator.hasNext(); ) {
Element element = iterator.next();
iterator.remove();
result.add(createItem(getSubStateFileName(element), generator, element));
}
if (!JDOMUtil.isEmpty(state)) {
result.add(createItem(getComponentStateFileName(), generator, state));
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MainConfigurationStateSplitter.java
示例9: splitState
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@NotNull
protected static List<Pair<Element, String>> splitState(@NotNull Element state, @NotNull String attributeName) {
UniqueNameGenerator generator = new UniqueNameGenerator();
List<Pair<Element, String>> result = new SmartList<Pair<Element, String>>();
for (Element subState : state.getChildren()) {
result.add(createItem(generator, subState, attributeName));
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:StateSplitterEx.java
示例10: generateServerName
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
private String generateServerName() {
return UniqueNameGenerator.generateUniqueName(myCloudType.getPresentableName(), new Condition<String>() {
@Override
public boolean value(String s) {
for (RemoteServer<?> server : RemoteServersManager.getInstance().getServers()) {
if (server.getName().equals(s)) {
return false;
}
}
return true;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CloudConfigurableBase.java
示例11: generateServerName
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
private static String generateServerName(ServerType<?> cloudType) {
return UniqueNameGenerator.generateUniqueName(cloudType.getPresentableName(), new Condition<String>() {
@Override
public boolean value(String s) {
for (RemoteServer<?> server : RemoteServersManager.getInstance().getServers()) {
if (server.getName().equals(s)) {
return false;
}
}
return true;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CloudAccountSelectionEditor.java
示例12: SaveSchemeDialog
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
public SaveSchemeDialog(@NotNull Component parent, String title, @NotNull List<String> existingNames, @NotNull String selectedName) {
super(parent, false);
myExistingNames = existingNames;
setTitle(title);
mySchemeName.setText(UniqueNameGenerator.generateUniqueName(selectedName + " copy", existingNames));
init();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SaveSchemeDialog.java
示例13: generateUniqueSchemePatchDir
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@NotNull
private File generateUniqueSchemePatchDir(@NotNull final String defaultName, boolean createResourceDirectory) {
ignoreShelfDirectoryIfFirstShelf();
String uniqueName = UniqueNameGenerator
.generateUniqueName(shortenAndSanitize(defaultName), mySchemeManager.getAllSchemeNames());
File dir = new File(myFileProcessor.getBaseDir(), uniqueName);
if (createResourceDirectory && !dir.exists()) {
//noinspection ResultOfMethodCallIgnored
dir.mkdirs();
}
return dir;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ShelveChangesManager.java
示例14: ExportRunConfigurationTableModel
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
ExportRunConfigurationTableModel(List<RunConfiguration> configurations) {
enabled = new Boolean[configurations.size()];
names = new String[configurations.size()];
paths = new String[configurations.size()];
UniqueNameGenerator nameGenerator = new UniqueNameGenerator();
for (int i = 0; i < configurations.size(); i++) {
RunConfiguration config = configurations.get(i);
enabled[i] = false;
names[i] = config.getName();
paths[i] =
nameGenerator.generateUniqueName(FileUtil.sanitizeFileName(config.getName()), "", ".xml");
}
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:15,代码来源:ExportRunConfigurationTableModel.java
示例15: splitState
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@Override
public List<Pair<Element, String>> splitState(Element e) {
final UniqueNameGenerator generator = new UniqueNameGenerator();
final List<Pair<Element, String>> result = new ArrayList<Pair<Element, String>>();
result.add(new Pair<Element, String>(e, generator.generateUniqueName("template_variable_settings") + ".xml"));
return result;
}
开发者ID:vkravets,项目名称:FileTemplatesVariable,代码行数:8,代码来源:PerProjectTemplateManager.java
示例16: substituteParameters
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
private static void substituteParameters(@NotNull JVMElementFactory factory,
@NotNull JavaCodeStyleManager codeStyleManager,
@NotNull PsiParameterList sourceParameterList,
@NotNull PsiParameterList targetParameterList,
@NotNull PsiSubstitutor substitutor, PsiElement target) {
PsiParameter[] parameters = sourceParameterList.getParameters();
UniqueNameGenerator generator = new UniqueNameGenerator();
for (PsiParameter parameter : parameters) {
final PsiType parameterType = parameter.getType();
final PsiType substituted = substituteType(substitutor, parameterType, (PsiMethod)parameter.getDeclarationScope());
@NonNls String paramName = parameter.getName();
boolean isBaseNameGenerated = true;
final boolean isSubstituted = substituted.equals(parameterType);
if (!isSubstituted && isBaseNameGenerated(codeStyleManager, TypeConversionUtil.erasure(parameterType), paramName)) {
isBaseNameGenerated = false;
}
if (paramName == null ||
isBaseNameGenerated && !isSubstituted && isBaseNameGenerated(codeStyleManager, parameterType, paramName) ||
!factory.isValidParameterName(paramName)) {
String[] names = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, null, substituted).names;
if (names.length > 0) {
paramName = generator.generateUniqueName(names[0]);
}
else {
paramName = generator.generateUniqueName("p");
}
}
else if (!generator.value(paramName)) {
paramName = generator.generateUniqueName(paramName);
}
generator.addExistingName(paramName);
final PsiParameter newParameter = factory.createParameter(paramName, substituted, target);
copyOrReplaceModifierList(parameter, newParameter);
targetParameterList.add(newParameter);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:39,代码来源:GenerateMembersUtil.java
示例17: splitState
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
public List<Pair<Element, String>> splitState(Element e) {
final UniqueNameGenerator generator = new UniqueNameGenerator();
List<Pair<Element, String>> result = new ArrayList<Pair<Element, String>>();
for (Element element : JDOMUtil.getElements(e)) {
final String name = generator.generateUniqueName(FileUtil.sanitizeFileName(element.getAttributeValue(ArtifactState.NAME_ATTRIBUTE))) + ".xml";
result.add(new Pair<Element, String>(element, name));
}
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:ArtifactManagerStateSplitter.java
示例18: splitState
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
public List<Pair<Element, String>> splitState(Element e) {
final UniqueNameGenerator generator = new UniqueNameGenerator();
List<Pair<Element, String>> result = new ArrayList<Pair<Element, String>>();
for (Element element : JDOMUtil.getElements(e)) {
final String name = generator.generateUniqueName(FileUtil.sanitizeFileName(element.getAttributeValue(DictionaryState.NAME_ATTRIBUTE))) + ".xml";
result.add(new Pair<Element, String>(element, name));
}
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ProjectDictionarySplitter.java
示例19: splitState
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@Override
public List<Pair<Element, String>> splitState(Element e) {
final UniqueNameGenerator generator = new UniqueNameGenerator();
List<Pair<Element, String>> result = new ArrayList<Pair<Element, String>>();
final List list = e.getChildren();
for (final Object o : list) {
Element library = (Element)o;
@NonNls final String name = generator.generateUniqueName(FileUtil.sanitizeFileName(library.getAttributeValue(LibraryImpl.LIBRARY_NAME_ATTR))) + ".xml";
result.add(new Pair<Element, String>(library, name));
}
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ProjectLibraryTable.java
示例20: splitState
import com.intellij.util.text.UniqueNameGenerator; //导入依赖的package包/类
@Override
public List<Pair<Element, String>> splitState(Element e) {
final UniqueNameGenerator generator = new UniqueNameGenerator();
List<Pair<Element, String>> result = new ArrayList<Pair<Element, String>>();
final List list = e.getChildren();
for (final Object o : list) {
Element library = (Element)o;
final String name = generator.generateUniqueName(FileUtil.sanitizeFileName(library.getAttributeValue(RunManagerImpl.NAME_ATTR))) + ".xml";
result.add(new Pair<Element, String>(library, name));
}
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ProjectRunConfigurationManager.java
注:本文中的com.intellij.util.text.UniqueNameGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论