use of de.janthomae.leiningenplugin.project.LeiningenProjectsManager in project intellij-leiningen-plugin by derkork.
the class AddManagedFilesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project ideaProject = e.getData(PlatformDataKeys.PROJECT);
final LeiningenProjectsManager manager = LeiningenProjectsManager.getInstance(ideaProject);
FileChooserDescriptor leinProjectFileDescriptor = new FileChooserDescriptor(true, false, false, false, false, true) {
@Override
public boolean isFileSelectable(VirtualFile file) {
return super.isFileSelectable(file) && !manager.isManagedFile(file);
}
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return (file.isDirectory() || LeiningenProjectsManager.isProjectFile(file)) && super.isFileVisible(file, showHiddenFiles);
}
};
VirtualFile fileToSelect = e.getData(PlatformDataKeys.VIRTUAL_FILE);
FileChooserDialog dialog = FileChooserFactory.getInstance().createFileChooser(leinProjectFileDescriptor, ideaProject, null);
VirtualFile[] files = dialog.choose(fileToSelect, ideaProject);
if (files.length == 0)
return;
for (VirtualFile file : files) {
manager.importLeiningenProject(file, ideaProject);
}
}
use of de.janthomae.leiningenplugin.project.LeiningenProjectsManager in project intellij-leiningen-plugin by derkork.
the class RefreshProjectsAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project theProject = e.getData(PlatformDataKeys.PROJECT);
final LeiningenProjectsManager manager = LeiningenProjectsManager.getInstance(theProject);
final List<LeiningenProject> projects = manager.getLeiningenProjects();
for (LeiningenProject project : projects) {
try {
project.reimport(theProject);
} catch (LeiningenProjectException e1) {
// Just ignore it for now
}
}
}
Aggregations