コード例 #1
0
  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();
  }
コード例 #2
0
 @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);
     }
   }
 }
コード例 #3
0
 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);
 }
コード例 #4
0
  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()]);
  }
コード例 #5
0
  @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()));
  }
コード例 #6
0
  @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()));
  }
コード例 #7
0
  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()]);
  }
コード例 #8
0
  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()));
  }
コード例 #9
0
 @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);
     }
   }
 }
コード例 #10
0
 private StructureConfigurableContext getStructureConfigurableContext() {
   return ProjectStructureConfigurable.getInstance(myState.getProject()).getContext();
 }
コード例 #11
0
 @Override
 public Project getProject() {
   return myState.getProject();
 }
コード例 #12
0
 @Override
 public ModifiableRootModel getRootModel() {
   return myState.getRootModel();
 }