use of com.intellij.openapi.project.ex.ProjectManagerEx in project Aspose.BarCode-for-Java by aspose-barcode.
the class AsposeMavenModuleBuilderHelper method copyMavenConfigurationFiles.
private void copyMavenConfigurationFiles(VirtualFile pom) {
try {
String projectPath = project.getBasePath();
final File workingDir = new File(getAsposeMavenWorkSpace());
String projectModulefile = projectPath + File.separator + project.getName() + ".iml";
String projectIdea_compiler_xml = projectPath + File.separator + ".idea" + File.separator + "compiler.xml";
String projectIdea_misc_xml = projectPath + File.separator + ".idea" + File.separator + "misc.xml";
VirtualFile vf_projectIdea_misc_xml = LocalFileSystem.getInstance().findFileByPath(projectIdea_misc_xml);
FileUtil.copy(new File(workingDir, intelliJMavenFiles.get(0)), new File(projectModulefile));
FileUtil.copy(new File(workingDir, intelliJMavenFiles.get(1)), new File(projectIdea_compiler_xml));
addMavenConfiguration(vf_projectIdea_misc_xml, projectIdea_misc_xml);
ProjectManagerEx pm = ProjectManagerEx.getInstanceEx();
pm.reloadProject(project);
EditorHelper.openInEditor(getPsiFile(project, pom));
} catch (IOException e) {
showError(project, e);
return;
} catch (Throwable e) {
}
}
use of com.intellij.openapi.project.ex.ProjectManagerEx in project Aspose.Cells-for-Java by aspose-cells.
the class AsposeMavenModuleBuilderHelper method copyMavenConfigurationFiles.
private void copyMavenConfigurationFiles(VirtualFile pom) {
try {
String projectPath = project.getBasePath();
final File workingDir = new File(getAsposeMavenWorkSpace());
String projectModulefile = projectPath + File.separator + project.getName() + ".iml";
String projectIdea_compiler_xml = projectPath + File.separator + ".idea" + File.separator + "compiler.xml";
String projectIdea_misc_xml = projectPath + File.separator + ".idea" + File.separator + "misc.xml";
VirtualFile vf_projectIdea_misc_xml = LocalFileSystem.getInstance().findFileByPath(projectIdea_misc_xml);
FileUtil.copy(new File(workingDir, intelliJMavenFiles.get(0)), new File(projectModulefile));
FileUtil.copy(new File(workingDir, intelliJMavenFiles.get(1)), new File(projectIdea_compiler_xml));
addMavenConfiguration(vf_projectIdea_misc_xml, projectIdea_misc_xml);
ProjectManagerEx pm = ProjectManagerEx.getInstanceEx();
pm.reloadProject(project);
EditorHelper.openInEditor(getPsiFile(project, pom));
} catch (IOException e) {
showError(project, e);
return;
} catch (Throwable e) {
}
}
use of com.intellij.openapi.project.ex.ProjectManagerEx in project intellij by bazelbuild.
the class BlazeProjectCreator method doCreate.
@Nullable
private Project doCreate() throws IOException {
final ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
final String projectFilePath = wizardContext.getProjectFileDirectory();
try {
File projectDir = new File(projectFilePath).getParentFile();
LOG.assertTrue(projectDir != null, "Cannot create project in '" + projectFilePath + "': no parent file exists");
FileUtil.ensureExists(projectDir);
if (wizardContext.getProjectStorageFormat() == StorageScheme.DIRECTORY_BASED) {
final File ideaDir = new File(projectFilePath, Project.DIRECTORY_STORE_FOLDER);
FileUtil.ensureExists(ideaDir);
}
String name = wizardContext.getProjectName();
Project newProject = projectBuilder.createProject(name, projectFilePath);
if (newProject == null) {
return null;
}
if (!ApplicationManager.getApplication().isUnitTestMode()) {
newProject.save();
}
if (!projectBuilder.validate(null, newProject)) {
return null;
}
projectBuilder.commit(newProject, null, ModulesProvider.EMPTY_MODULES_PROVIDER);
StartupManager.getInstance(newProject).registerPostStartupActivity(() -> {
// ensure the dialog is shown after all startup activities are done
// noinspection SSBasedInspection
SwingUtilities.invokeLater(() -> {
if (newProject.isDisposed() || ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
ApplicationManager.getApplication().invokeLater(() -> {
if (newProject.isDisposed()) {
return;
}
final ToolWindow toolWindow = ToolWindowManager.getInstance(newProject).getToolWindow(ToolWindowId.PROJECT_VIEW);
if (toolWindow != null) {
toolWindow.activate(null);
}
}, ModalityState.NON_MODAL);
});
});
ProjectUtil.updateLastProjectLocation(projectFilePath);
if (WindowManager.getInstance().isFullScreenSupportedInCurrentOS()) {
IdeFocusManager instance = IdeFocusManager.findInstance();
IdeFrame lastFocusedFrame = instance.getLastFocusedFrame();
if (lastFocusedFrame instanceof IdeFrameEx) {
boolean fullScreen = ((IdeFrameEx) lastFocusedFrame).isInFullScreen();
if (fullScreen) {
newProject.putUserData(IdeFrameImpl.SHOULD_OPEN_IN_FULL_SCREEN, Boolean.TRUE);
}
}
}
projectManager.openProject(newProject);
if (!ApplicationManager.getApplication().isUnitTestMode()) {
newProject.save();
}
return newProject;
} finally {
projectBuilder.cleanup();
}
}
Aggregations