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 navigate(boolean openLibraryEditor) { final OrderEntry entry = getSelectedEntry(); final ProjectStructureConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myState.getProject()); if (entry instanceof ModuleOrderEntry) { Module module = ((ModuleOrderEntry) entry).getModule(); if (module != null) { rootConfigurable.select(module.getName(), null, true); } } else if (entry instanceof LibraryOrderEntry) { if (!openLibraryEditor && !((LibraryOrderEntry) entry) .getLibraryLevel() .equals(LibraryTableImplUtil.MODULE_LEVEL)) { rootConfigurable.select((LibraryOrderEntry) entry, true); } else { doEdit(); } } else if (entry instanceof JdkOrderEntry) { Sdk jdk = ((JdkOrderEntry) entry).getJdk(); if (jdk != null) { rootConfigurable.select(jdk, true); } } }
public void selectOrderEntry(@NotNull OrderEntry entry) { for (int row = 0; row < myModel.getRowCount(); row++) { final OrderEntry orderEntry = getItemAt(row).getEntry(); if (orderEntry != null && entry.getPresentableName().equals(orderEntry.getPresentableName())) { myEntryTable.getSelectionModel().setSelectionInterval(row, row); TableUtil.scrollSelectionToVisible(myEntryTable); } } IdeFocusManager.getInstance(myState.getProject()).requestFocus(myEntryTable, true); }
public ModuleConfigurationEditor[] createEditors(@NotNull ModuleConfigurationState state) { ModifiableRootModel rootModel = state.getRootModel(); Module module = rootModel.getModule(); if (!(ModuleType.get(module) instanceof GoModuleType)) { return ModuleConfigurationEditor.EMPTY; } String moduleName = module.getName(); List<ModuleConfigurationEditor> editors = new ArrayList<ModuleConfigurationEditor>(); editors.add(new ContentEntriesEditor(moduleName, state)); editors.add(new OutputEditorEx(state)); editors.add(new ClasspathEditor(state)); return editors.toArray(new ModuleConfigurationEditor[editors.size()]); }
@Override public void addItems(List<ClasspathTableItem<?>> toAdd) { for (ClasspathTableItem<?> item : toAdd) { myModel.addItem(item); } myModel.fireTableDataChanged(); final ListSelectionModel selectionModel = myEntryTable.getSelectionModel(); selectionModel.setSelectionInterval( myModel.getRowCount() - toAdd.size(), myModel.getRowCount() - 1); TableUtil.scrollSelectionToVisible(myEntryTable); final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext(); context .getDaemonAnalyzer() .queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule())); }
@Override public void addItems(List<ClasspathTableItem<?>> toAdd) { for (ClasspathTableItem<?> item : toAdd) { myModel.addRow(item); } TIntArrayList toSelect = new TIntArrayList(); for (int i = myModel.getRowCount() - toAdd.size(); i < myModel.getRowCount(); i++) { toSelect.add(myEntryTable.convertRowIndexToView(i)); } TableUtil.selectRows(myEntryTable, toSelect.toNativeArray()); TableUtil.scrollSelectionToVisible(myEntryTable); final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext(); context .getDaemonAnalyzer() .queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule())); }
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) { final Module module = state.getRootModel().getModule(); final ModuleType moduleType = ModuleType.get(module); if (!(moduleType instanceof GoModuleType) && !(moduleType instanceof GoAppEngineModuleType)) { return ModuleConfigurationEditor.EMPTY; } final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance(); List<ModuleConfigurationEditor> editors = new ArrayList<ModuleConfigurationEditor>(); editors.add(editorFactory.createModuleContentRootsEditor(state)); editors.add(editorFactory.createOutputEditor(state)); editors.add(editorFactory.createClasspathEditor(state)); // editors.add(new PluginModuleBuildConfEditor(state)); return editors.toArray(new ModuleConfigurationEditor[editors.size()]); }
private void removeSelectedItems(final List removedRows) { if (removedRows.isEmpty()) { return; } for (final Object removedRow : removedRows) { final ClasspathTableItem<?> item = (ClasspathTableItem<?>) ((Object[]) removedRow)[ClasspathTableModel.ITEM_COLUMN]; final OrderEntry orderEntry = item.getEntry(); if (orderEntry == null) { continue; } getRootModel().removeOrderEntry(orderEntry); } final int[] selectedRows = myEntryTable.getSelectedRows(); myModel.fireTableDataChanged(); TableUtil.selectRows(myEntryTable, selectedRows); final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext(); context .getDaemonAnalyzer() .queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule())); }
@Override public void navigate(boolean openLibraryEditor) { final OrderEntry entry = getSelectedEntry(); final ProjectStructureConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myState.getProject()); if (entry instanceof ModuleOrderEntry) { Module module = ((ModuleOrderEntry) entry).getModule(); if (module != null) { rootConfigurable.select(module.getName(), null, true); } } else if (entry instanceof LibraryOrderEntry) { if (!openLibraryEditor) { rootConfigurable.select((LibraryOrderEntry) entry, true); } else { myEditButton.actionPerformed(null); } } else if (entry instanceof SdkOrderEntry) { Sdk jdk = ((SdkOrderEntry) entry).getSdk(); if (jdk != null) { rootConfigurable.select(jdk, true); } } }
private StructureConfigurableContext getStructureConfigurableContext() { return ProjectStructureConfigurable.getInstance(myState.getProject()).getContext(); }
@Override public Project getProject() { return myState.getProject(); }
@Override public ModifiableRootModel getRootModel() { return myState.getRootModel(); }