use of com.intellij.ide.ProjectGroup in project intellij-community by JetBrains.
the class CreateNewProjectGroupAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final InputValidator validator = new InputValidator() {
@Override
public boolean checkInput(String inputString) {
inputString = inputString.trim();
return getGroup(inputString) == null;
}
@Override
public boolean canClose(String inputString) {
return true;
}
};
final String newGroup = Messages.showInputDialog((Project) null, "Project group name", "Create New Project Group", null, null, validator);
if (newGroup != null) {
final ProjectGroup group = new ProjectGroup(newGroup);
RecentProjectsManager.getInstance().addGroup(group);
rebuildRecentProjectsList(e);
}
}
use of com.intellij.ide.ProjectGroup in project intellij-community by JetBrains.
the class MoveProjectToGroupAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final List<AnAction> elements = getSelectedElements(e);
for (AnAction element : elements) {
if (element instanceof ReopenProjectAction) {
final String path = ((ReopenProjectAction) element).getProjectPath();
for (ProjectGroup group : RecentProjectsManager.getInstance().getGroups()) {
group.removeProject(path);
myGroup.addProject(path);
}
}
}
rebuildRecentProjectsList(e);
}
use of com.intellij.ide.ProjectGroup in project intellij-community by JetBrains.
the class RemoveSelectedProjectsFromGroupsAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final List<AnAction> elements = getSelectedElements(e);
for (AnAction element : elements) {
if (element instanceof ReopenProjectAction) {
for (ProjectGroup group : RecentProjectsManager.getInstance().getGroups()) {
group.removeProject(((ReopenProjectAction) element).getProjectPath());
}
}
}
rebuildRecentProjectsList(e);
}
use of com.intellij.ide.ProjectGroup in project intellij-community by JetBrains.
the class EditProjectGroupAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final ProjectGroup group = ((ProjectGroupActionGroup) getSelectedElements(e).get(0)).getGroup();
JList list = getList(e);
assert list != null;
DefaultListModel model = getDataModel(e);
String name = Messages.showInputDialog(list, "Enter group name: ", "Change Group Name", null, group.getName(), new InputValidatorEx() {
@Nullable
@Override
public String getErrorText(String inputString) {
inputString = inputString.trim();
if (inputString.length() == 0) {
return "Name cannot be empty.";
}
if (!checkInput(inputString)) {
return "Group '" + inputString + "' already exists.";
}
return null;
}
@Override
public boolean checkInput(String inputString) {
inputString = inputString.trim();
if (inputString.equals(group.getName()))
return true;
for (ProjectGroup projectGroup : RecentProjectsManager.getInstance().getGroups()) {
if (projectGroup.getName().equals(inputString)) {
return false;
}
}
return true;
}
@Override
public boolean canClose(String inputString) {
return true;
}
});
if (name != null && model != null) {
group.setName(name);
rebuildRecentProjectDataModel(model);
for (int i = 0; i < model.getSize(); i++) {
Object element = model.get(i);
if (element instanceof ProjectGroupActionGroup) {
if (((ProjectGroupActionGroup) element).getGroup().equals(group)) {
ScrollingUtil.selectItem(list, i);
break;
}
}
}
}
}
use of com.intellij.ide.ProjectGroup in project intellij-community by JetBrains.
the class MoveProjectToGroupActionGroup method update.
@Override
public void update(AnActionEvent e) {
removeAll();
final List<ProjectGroup> groups = new ArrayList<>(RecentProjectsManager.getInstance().getGroups());
Collections.sort(groups, (o1, o2) -> StringUtil.naturalCompare(o1.getName(), o2.getName()));
for (ProjectGroup group : groups) {
add(new MoveProjectToGroupAction(group));
}
if (groups.size() > 0) {
add(Separator.getInstance());
add(new RemoveSelectedProjectsFromGroupsAction());
}
}
Aggregations