本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
});
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}