mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-83702: Context menu in Dependency editor should has 'edit' action
This commit is contained in:
+27
-25
@@ -178,8 +178,13 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
WHEN_FOCUSED
|
||||
);
|
||||
|
||||
myEditButton = new AnActionButton(ProjectBundle.message("module.classpath.button.edit"), null, IconUtil.getEditIcon()) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
doEdit();
|
||||
}
|
||||
};
|
||||
add(createTableWithButtons(), BorderLayout.CENTER);
|
||||
//add(createButtonsBlock(), BorderLayout.EAST);
|
||||
|
||||
if (myEntryTable.getRowCount() > 0) {
|
||||
myEntryTable.getSelectionModel().setSelectionInterval(0,0);
|
||||
@@ -212,6 +217,7 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
};
|
||||
navigateAction.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getShortcutSet(),
|
||||
myEntryTable);
|
||||
actionGroup.add(myEditButton);
|
||||
actionGroup.add(navigateAction);
|
||||
actionGroup.add(new MyFindUsagesAction());
|
||||
actionGroup.add(new AnalyzeDependencyAction());
|
||||
@@ -280,30 +286,6 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
}
|
||||
};
|
||||
|
||||
myEditButton = new AnActionButton(ProjectBundle.message("module.classpath.button.edit"), null, IconUtil.getEditIcon()) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final OrderEntry entry = getSelectedEntry();
|
||||
if (!(entry instanceof LibraryOrderEntry)) return;
|
||||
|
||||
final Library library = ((LibraryOrderEntry)entry).getLibrary();
|
||||
if (library == null) {
|
||||
return;
|
||||
}
|
||||
final LibraryTable table = library.getTable();
|
||||
final String tableLevel = table != null ? table.getTableLevel() : LibraryTableImplUtil.MODULE_LEVEL;
|
||||
final LibraryTablePresentation presentation = LibraryEditingUtil.getLibraryTablePresentation(getProject(), tableLevel);
|
||||
final LibraryTableModifiableModelProvider provider = getModifiableModelProvider(tableLevel);
|
||||
EditExistingLibraryDialog dialog = EditExistingLibraryDialog.createDialog(ClasspathPanelImpl.this, provider, library, myState.getProject(),
|
||||
presentation, getStructureConfigurableContext());
|
||||
dialog.setContextModule(getRootModel().getModule());
|
||||
dialog.show();
|
||||
myEntryTable.repaint();
|
||||
ModuleStructureConfigurable.getInstance(myState.getProject()).getTree().repaint();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
final AnActionButton analyzeButton = new AnActionButton(ProjectBundle.message("classpath.panel.analyze"), null, SystemInfo.isMac ? PlatformIcons.TABLE_ANALYZE : PlatformIcons.ANALYZE) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
@@ -395,6 +377,26 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
return panel;
|
||||
}
|
||||
|
||||
private void doEdit() {
|
||||
final OrderEntry entry = getSelectedEntry();
|
||||
if (!(entry instanceof LibraryOrderEntry)) return;
|
||||
|
||||
final Library library = ((LibraryOrderEntry)entry).getLibrary();
|
||||
if (library == null) {
|
||||
return;
|
||||
}
|
||||
final LibraryTable table = library.getTable();
|
||||
final String tableLevel = table != null ? table.getTableLevel() : LibraryTableImplUtil.MODULE_LEVEL;
|
||||
final LibraryTablePresentation presentation = LibraryEditingUtil.getLibraryTablePresentation(getProject(), tableLevel);
|
||||
final LibraryTableModifiableModelProvider provider = getModifiableModelProvider(tableLevel);
|
||||
EditExistingLibraryDialog dialog = EditExistingLibraryDialog.createDialog(this, provider, library, myState.getProject(),
|
||||
presentation, getStructureConfigurableContext());
|
||||
dialog.setContextModule(getRootModel().getModule());
|
||||
dialog.show();
|
||||
myEntryTable.repaint();
|
||||
ModuleStructureConfigurable.getInstance(myState.getProject()).getTree().repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNotify() {
|
||||
super.addNotify();
|
||||
|
||||
Reference in New Issue
Block a user