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


Java ModifiableModuleModel.renameModule方法代码示例

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


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

示例1: setDisplayName

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Override
public void setDisplayName(String name) {
  name = name.trim();
  final ModifiableModuleModel modifiableModuleModel = myConfigurator.getModuleModel();
  if (StringUtil.isEmpty(name)) return; //empty string comes on double click on module node
  if (Comparing.strEqual(name, myModuleName)) return; //nothing changed
  try {
    modifiableModuleModel.renameModule(myModule, name);
  }
  catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
    //do nothing
  }
  myConfigurator.moduleRenamed(myModule, myModuleName, name);
  myModuleName = name;
  myConfigurator.setModified(!Comparing.strEqual(myModuleName, myModule.getName()));
  myContext.getDaemonAnalyzer().queueUpdateForAllElementsWithErrors();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ModuleConfigurable.java

示例2: setDisplayName

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Override
public void setDisplayName(String name) {
  name = name.trim();
  final ModifiableModuleModel modifiableModuleModel = myConfigurator.getModuleModel();
  if (StringUtil.isEmpty(name)) return; //empty string comes on double click on module node
  if (Comparing.strEqual(name, myModuleName)) return; //nothing changed
  try {
    modifiableModuleModel.renameModule(myModule, name);
  }
  catch (ModuleWithNameAlreadyExistsException ignored) {
  }
  myConfigurator.moduleRenamed(myModule, myModuleName, name);
  myModuleName = name;
  myConfigurator.setModified(!Comparing.strEqual(myModuleName, myModule.getName()));
  myContext.getDaemonAnalyzer().queueUpdateForAllElementsWithErrors();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ModuleConfigurable.java

示例3: canClose

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Override
public boolean canClose(final String inputString) {
  if (shouldRenameProject(inputString)) {
    myProject.setProjectName(inputString);
    myProject.save();
  }

  if (myModule != null && !inputString.equals(myModule.getName())) {
    final ModifiableModuleModel modifiableModel = ModuleManager.getInstance(myProject).getModifiableModel();
    try {
      modifiableModel.renameModule(myModule, inputString);
    }
    catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
      Messages.showErrorDialog(myProject, IdeBundle.message("error.module.already.exists", inputString),
                               IdeBundle.message("title.rename.module"));
      return false;
    }
    final Ref<Boolean> success = Ref.create(Boolean.TRUE);
    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          @Override
          public void run() {
            DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
              @Override
              public void run() {
                modifiableModel.commit();
              }
            });
          }
        });
      }
    }, IdeBundle.message("command.renaming.module", myModule.getName()), null);
    return success.get().booleanValue();
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:RenameProjectHandler.java

示例4: renameModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Nullable
private ModifiableModuleModel renameModule(String inputString) {
  final ModifiableModuleModel modifiableModel = ModuleManager.getInstance(myProject).getModifiableModel();
  try {
    modifiableModel.renameModule(myModule, inputString);
  }
  catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
    Messages.showErrorDialog(myProject, IdeBundle.message("error.module.already.exists", inputString),
                             IdeBundle.message("title.rename.module"));
    return null;
  }
  return modifiableModel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:RenameModuleHandler.java

示例5: renameModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
private static void renameModule(Module from, String name) throws ModuleWithNameAlreadyExists {
  final ModifiableModuleModel model = ModuleManager.getInstance(from.getProject()).getModifiableModel();
  model.renameModule(from, name);
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      model.commit();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ProjectResourceRepositoryTest.java

示例6: canClose

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Override
public boolean canClose(final String inputString) {
  if (!inputString.equals(myProject.getName())) {
    myProject.setProjectName(inputString);
    myProject.save();
  }

  if (myModule != null && !inputString.equals(myModule.getName())) {
    final ModifiableModuleModel modifiableModel = ModuleManager.getInstance(myProject).getModifiableModel();
    try {
      modifiableModel.renameModule(myModule, inputString);
    }
    catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
      Messages.showErrorDialog(myProject, IdeBundle.message("error.module.already.exists", inputString),
                               IdeBundle.message("title.rename.module"));
      return false;
    }
    final Ref<Boolean> success = Ref.create(Boolean.TRUE);
    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          @Override
          public void run() {
            modifiableModel.commit();
          }
        });
      }
    }, IdeBundle.message("command.renaming.module", myModule.getName()), null);
    return success.get().booleanValue();
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:RenameProjectHandler.java

示例7: testRenameModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
public void testRenameModule() throws Exception {
  final NamedPointer<Module> pointer = ModuleUtilCore.createPointer(getProject(), "abc");
  final Module module = addModule("abc");
  ModifiableModuleModel model = getModuleManager().getModifiableModel();
  model.renameModule(module, "xyz");
  commitModel(model);
  assertSame(module, pointer.get());
  assertEquals("xyz", pointer.getName());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ModulePointerTest.java

示例8: canClose

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Override
public boolean canClose(final String inputString) {
  if (!inputString.equals(myProject.getName())) {
    myProject.setProjectName(inputString);
    myProject.save();
  }

  if (myModule != null && !inputString.equals(myModule.getName())) {
    final ModifiableModuleModel modifiableModel = ModuleManager.getInstance(myProject).getModifiableModel();
    try {
      modifiableModel.renameModule(myModule, inputString);
    }
    catch (ModuleWithNameAlreadyExistsException moduleWithNameAlreadyExists) {
      Messages.showErrorDialog(myProject, IdeBundle.message("error.module.already.exists", inputString),
                               IdeBundle.message("title.rename.module"));
      return false;
    }
    final Ref<Boolean> success = Ref.create(Boolean.TRUE);
    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          @Override
          public void run() {
            modifiableModel.commit();
          }
        });
      }
    }, IdeBundle.message("command.renaming.module", myModule.getName()), null);
    return success.get().booleanValue();
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:34,代码来源:RenameProjectHandler.java

示例9: renameModule

import com.intellij.openapi.module.ModifiableModuleModel; //导入方法依赖的package包/类
@Nullable
private ModifiableModuleModel renameModule(String inputString) {
  final ModifiableModuleModel modifiableModel = ModuleManager.getInstance(myProject).getModifiableModel();
  try {
    modifiableModel.renameModule(myModule, inputString);
  }
  catch (ModuleWithNameAlreadyExistsException moduleWithNameAlreadyExists) {
    Messages.showErrorDialog(myProject, IdeBundle.message("error.module.already.exists", inputString),
                             IdeBundle.message("title.rename.module"));
    return null;
  }
  return modifiableModel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:RenameModuleHandler.java


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