本文整理汇总了Java中com.intellij.ide.ReopenProjectAction类的典型用法代码示例。如果您正苦于以下问题:Java ReopenProjectAction类的具体用法?Java ReopenProjectAction怎么用?Java ReopenProjectAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReopenProjectAction类属于com.intellij.ide包,在下文中一共展示了ReopenProjectAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
List<AnAction> elements = getSelectedElements(e);
String path = ((ReopenProjectAction)elements.get(0)).getProjectPath();
final ChangeProjectIconForm form = new ChangeProjectIconForm(path);
DialogWrapper dialog = new DialogWrapper(null) {
{
init();
}
@Nullable
@Override
protected JComponent createCenterPanel() {
return form.myRootPanel;
}
};
dialog.show();
if (dialog.isOK()) {
try {
form.apply();
}
catch (IOException e1) {
System.out.println(e1);
}
}
}
示例2: getListCellRendererComponent
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
myHovered = myHoverIndex == index;
Color fore = getListForeground(isSelected, list.hasFocus());
Color back = getListBackground(isSelected, list.hasFocus());
myName.setForeground(fore);
myPath.setForeground(isSelected ? fore : UIUtil.getInactiveTextColor());
setBackground(back);
if (value instanceof ReopenProjectAction) {
ReopenProjectAction item = (ReopenProjectAction)value;
myName.setText(item.getTemplatePresentation().getText());
myPath.setText(getTitle2Text(item, myPath, JBUI.scale(40)));
} else if (value instanceof ProjectGroupActionGroup) {
final ProjectGroupActionGroup group = (ProjectGroupActionGroup)value;
myName.setText(group.getGroup().getName());
myPath.setText("");
}
return this;
}
示例3: updateRecentProjectsMenu
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu () {
RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
if (projectsManager == null) return;
final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
recentProjectsMenu.removeAll();
for (final AnAction action : recentProjectActions) {
MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext(null)));
}
});
recentProjectsMenu.add(menuItem);
}
}
示例4: getTitle2Text
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
private String getTitle2Text(ReopenProjectAction action, JComponent pathLabel) {
String fullText = action.getProjectPath();
int labelWidth = pathLabel.getWidth();
if (fullText == null || fullText.length() == 0) return " ";
String home = SystemProperties.getUserHome();
if (FileUtil.startsWith(fullText, home)) {
fullText = "~" + fullText.substring(home.length());
}
if (pathLabel.getFontMetrics(pathLabel.getFont()).stringWidth(fullText) > labelWidth) {
return myPathShortener.getShortPath(action);
}
return fullText;
}
示例5: getListCellRendererComponent
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
ReopenProjectAction item = (ReopenProjectAction)value;
Color fore = isSelected ? UIUtil.getListSelectionForeground() : list.getForeground();
Color back = isSelected ? cellHasFocus ? UIUtil.getListSelectionBackground() : UIUtil.getListUnfocusedSelectionBackground() : list.getBackground();
myName.setForeground(fore);
myPath.setForeground(isSelected ? fore : UIUtil.getInactiveTextColor());
setBackground(back);
myName.setText(item.getProjectName());
myPath.setText(getTitle2Text(item, myPath));
return this;
}
示例6: updateRecentProjectsMenu
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
public void updateRecentProjectsMenu () {
final AnAction[] recentProjectActions = RecentProjectsManagerBase.getInstance().getRecentProjectsActions(false);
recentProjectsMenu.removeAll();
for (final AnAction action : recentProjectActions) {
MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
action.actionPerformed(new AnActionEvent(null, DataManager.getInstance().getDataContext(null),
ActionPlaces.DOCK_MENU, action.getTemplatePresentation(),
ActionManager.getInstance(), 0));
}
});
recentProjectsMenu.add(menuItem);
}
}
示例7: getListCellRendererComponent
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
myHovered = myHoverIndex == index;
Color fore = getListForeground(isSelected, list.hasFocus());
Color back = getListBackground(isSelected, list.hasFocus());
myName.setForeground(fore);
myPath.setForeground(isSelected ? fore : UIUtil.getInactiveTextColor());
setBackground(back);
if (value instanceof ReopenProjectAction) {
ReopenProjectAction item = (ReopenProjectAction)value;
myName.setText(getTitle2Text(item.getTemplatePresentation().getText(), myName, JBUI.scale(55)));
myPath.setText(getTitle2Text(item.getProjectPath(), myPath, JBUI.scale(55)));
}
else if (value instanceof ProjectGroupActionGroup) {
final ProjectGroupActionGroup group = (ProjectGroupActionGroup)value;
myName.setText(group.getGroup().getName());
myPath.setText("");
}
AccessibleContextUtil.setCombinedName(this, myName, " - ", myPath);
AccessibleContextUtil.setCombinedDescription(this, myName, " - ", myPath);
return this;
}
示例8: updateRecentProjectsMenu
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu () {
RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
if (projectsManager == null) return;
final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
recentProjectsMenu.removeAll();
for (final AnAction action : recentProjectActions) {
MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext((Component)null)));
}
});
recentProjectsMenu.add(menuItem);
}
}
示例9: updateRecentProjectsMenu
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu() {
if (ApplicationProperties.isInSandbox()) {
return;
}
final AnAction[] recentProjectActions = RecentProjectsManager.getInstance().getRecentProjectsActions(false);
RecentTasks.clear();
String name = ApplicationNamesInfo.getInstance().getProductName().toLowerCase(Locale.US);
File exePath = new File(PathManager.getAppHomeDirectory(), name + (SystemInfo.is64Bit ? "64" : "") + ".exe");
if(!exePath.exists()) {
throw new IllegalArgumentException("Executable is not exists. Path: " + exePath.getPath());
}
String launcher = RecentTasks.getShortenPath(exePath.getPath());
Task[] tasks = new Task[recentProjectActions.length];
for (int i = 0; i < recentProjectActions.length; i++) {
ReopenProjectAction rpa = (ReopenProjectAction)recentProjectActions[i];
tasks[i] = new Task(launcher, RecentTasks.getShortenPath(rpa.getProjectPath()), rpa.getTemplatePresentation().getText());
}
RecentTasks.addTasks(tasks);
}
示例10: actionPerformed
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@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);
}
示例11: actionPerformed
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@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);
}
示例12: update
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
List<AnAction> selectedElements = getSelectedElements(e);
boolean hasProject = false;
boolean hasGroup = false;
for (AnAction element : selectedElements) {
if (element instanceof ReopenProjectAction) {
hasProject = true;
}
if (element instanceof ProjectGroupActionGroup) {
hasGroup = true;
}
if (hasGroup && hasProject) {
e.getPresentation().setEnabled(false);
return;
}
}
if (ActionPlaces.WELCOME_SCREEN.equals(e.getPlace())) {
presentation.setEnabledAndVisible(true);
if (selectedElements.size() == 1 && selectedElements.get(0) instanceof ProjectGroupActionGroup) {
presentation.setText("Open All Projects in Group");
} else {
presentation.setText("Open Selected");
}
} else {
presentation.setEnabledAndVisible(false);
}
}
示例13: removeRecentProjectElement
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
protected static void removeRecentProjectElement(Object element) {
final RecentProjectsManager manager = RecentProjectsManager.getInstance();
if (element instanceof ReopenProjectAction) {
manager.removePath(((ReopenProjectAction)element).getProjectPath());
} else if (element instanceof ProjectGroupActionGroup) {
final ProjectGroup group = ((ProjectGroupActionGroup)element).getGroup();
for (String path : group.getProjects()) {
manager.removePath(path);
}
manager.removeGroup(group);
}
}
示例14: RecentProjectItemRenderer
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
protected RecentProjectItemRenderer(UniqueNameBuilder<ReopenProjectAction> pathShortener) {
super(new VerticalFlowLayout());
myShortener = pathShortener;
myPath.setFont(JBUI.Fonts.label(SystemInfo.isMac ? 10f : 11f));
setFocusable(true);
layoutComponents();
}
示例15: getTitle2Text
import com.intellij.ide.ReopenProjectAction; //导入依赖的package包/类
protected String getTitle2Text(ReopenProjectAction action, JComponent pathLabel, int leftOffset) {
String fullText = action.getProjectPath();
if (fullText == null || fullText.length() == 0) return " ";
fullText = FileUtil.getLocationRelativeToUserHome(fullText, false);
try {
FontMetrics fm = pathLabel.getFontMetrics(pathLabel.getFont());
int maxWidth = RecentProjectPanel.this.getWidth() - leftOffset;
if (maxWidth > 0 && fm.stringWidth(fullText) > maxWidth) {
int left = 1; int right = 1;
int center = fullText.length() / 2;
String s = fullText.substring(0, center - left) + "..." + fullText.substring(center + right);
while (fm.stringWidth(s) > maxWidth) {
if (left == right) {
left++;
} else {
right++;
}
if (center - left < 0 || center + right >= fullText.length()) {
return "";
}
s = fullText.substring(0, center - left) + "..." + fullText.substring(center + right);
}
return s;
}
} catch (Exception e) {
LOG.error("Path label font: " + pathLabel.getFont());
LOG.error("Panel width: " + RecentProjectPanel.this.getWidth());
LOG.error(e);
}
return fullText;
}