com.intellij.openapi.module.ModuleConfigurationEditor Java Examples

The following examples show how to use com.intellij.openapi.module.ModuleConfigurationEditor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GaugeModuleConfigurationProvider.java    From Intellij-Plugin with Apache License 2.0 6 votes vote down vote up
@Override
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
    final Module module = state.getRootModel().getModule();

    final ModuleType moduleType = ModuleType.get(module);

    if (!(moduleType instanceof GaugeModuleType)) {
        return ModuleConfigurationEditor.EMPTY;
    }

    final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance();
    List<ModuleConfigurationEditor> editors = new ArrayList<>();
    editors.add(editorFactory.createModuleContentRootsEditor(state));
    editors.add(editorFactory.createOutputEditor(state));
    editors.add(editorFactory.createClasspathEditor(state));
    return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
 
Example #2
Source File: DojoToolkitModuleEditorProvider.java    From needsmoredojo with Apache License 2.0 6 votes vote down vote up
@Override
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState moduleConfigurationState) {
    final Module module = moduleConfigurationState.getRootModel().getModule();
    if (ModuleType.get(module) != DojoToolkitModuleType.getInstance()) return ModuleConfigurationEditor.EMPTY;

    final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance();
    List<ModuleConfigurationEditor> editors = new ArrayList<ModuleConfigurationEditor>();
    //editors.add(editorFactory.createModuleContentRootsEditor(moduleConfigurationState));

    for(Module theModule : ModuleManager.getInstance(moduleConfigurationState.getProject()).getModules())
    {
        ModuleType theType = ModuleType.get(theModule);

        int i=0;
    }

    return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
 
Example #3
Source File: ModuleStructureConfigurable.java    From consulo with Apache License 2.0 6 votes vote down vote up
public AsyncResult<Void> selectOrderEntry(@Nonnull final Module module, @Nullable final OrderEntry orderEntry) {
  Place p = new Place();
  p.putPath(ProjectStructureConfigurable.CATEGORY, this);
  Runnable r = null;

  final MasterDetailsComponent.MyNode node = findModuleNode(module);
  if (node != null) {
    p.putPath(TREE_OBJECT, module);
    p.putPath(ModuleEditor.SELECTED_EDITOR_NAME, ClasspathEditor.NAME);
    r = new Runnable() {
      @Override
      public void run() {
        if (orderEntry != null) {
          ModuleEditor moduleEditor = ((ModuleConfigurable)node.getConfigurable()).getModuleEditor();
          ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
          if (editor instanceof ClasspathEditor) {
            ((ClasspathEditor)editor).selectOrderEntry(orderEntry);
          }
        }
      }
    };
  }
  final AsyncResult<Void> result = ProjectStructureConfigurable.getInstance(myProject).navigateTo(p, true);
  return r != null ? result.doWhenDone(r) : result;
}
 
Example #4
Source File: TabbedModuleEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected JComponent createCenterPanel() {
  myTabbedPane = new TabbedPaneWrapper(this);

  for (ModuleConfigurationEditor editor : myEditors) {
    myTabbedPane.addTab(editor.getDisplayName(), editor.createComponent());
    editor.reset();
  }
  restoreSelectedEditor();

  myTabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      saveSelectedEditor();
      if (myHistory != null) {
        myHistory.pushQueryPlace();
      }
    }
  });
  return myTabbedPane.getComponent();
}
 
Example #5
Source File: HeaderHidingTabbedModuleEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nullable
public ModuleConfigurationEditor getEditor(@Nonnull String displayName) {
  ModuleConfigurationEditor singleEditor = getSingleEditor();
  if (singleEditor != null) {
    if (displayName.equals(singleEditor.getDisplayName())) {
      return singleEditor;
    }
    else {
      return null;
    }
  }
  else {
    return super.getEditor(displayName);
  }
}
 
Example #6
Source File: ModuleEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void dispose() {
  try {
    for (final ModuleConfigurationEditor myEditor : myEditors) {
      myEditor.disposeUIResources();
    }

    myEditors.clear();

    disposeCenterPanel();

    if (myModifiableRootModel != null) {
      myModifiableRootModel.dispose();
    }

    myGenericSettingsPanel = null;
  }
  finally {
    myModifiableRootModel = null;
    myModifiableRootModelProxy = null;
  }
}
 
Example #7
Source File: ModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ModifiableRootModel apply() throws ConfigurationException {
  try {
    for (ModuleConfigurationEditor editor : myEditors) {
      editor.saveData();
      editor.apply();
    }

    return myModifiableRootModel;
  }
  finally {
    myModifiableRootModel = null;
    myModifiableRootModelProxy = null;
  }
}
 
Example #8
Source File: CppModuleConfigurationEditorProvider.java    From CppTools with Apache License 2.0 5 votes vote down vote up
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
  final Module module = state.getRootModel().getModule();
  if (ModuleType.get(module) != CppModuleType.getInstance()) return new ModuleConfigurationEditor[0];

  ModifiableRootModel rootModel = state.getRootModel();

  DefaultModuleConfigurationEditorFactory defaultModuleConfigurationEditorFactory = DefaultModuleConfigurationEditorFactory.getInstance();
  return new ModuleConfigurationEditor[] {
    defaultModuleConfigurationEditorFactory.createModuleContentRootsEditor(state),
    defaultModuleConfigurationEditorFactory.createClasspathEditor(state),
  };
}
 
Example #9
Source File: TabbedModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public ModuleConfigurationEditor getSelectedEditor() {
  if (myTabbedPane == null) {
    return null;
  }

  String title = myTabbedPane.getSelectedTitle();
  if (title == null) {
    return null;
  }

  return getEditor(title);
}
 
Example #10
Source File: TabbedModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public ModuleConfigurationEditor getEditor(@Nonnull String displayName) {
  int index = getEditorTabIndex(displayName);
  if (0 <= index && index < myEditors.size()) {
    return myEditors.get(index);
  }
  return null;
}
 
Example #11
Source File: HeaderHidingTabbedModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void queryPlace(@Nonnull Place place) {
  ModuleConfigurationEditor singleEditor = getSingleEditor();
  if (singleEditor != null) {
    place.putPath(ModuleEditor.SELECTED_EDITOR_NAME, singleEditor.getDisplayName());
  }
  else {
    super.queryPlace(place);
  }
}
 
Example #12
Source File: HeaderHidingTabbedModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void restoreSelectedEditor() {
  ModuleConfigurationEditor singleEditor = getSingleEditor();
  if (singleEditor == null) {
    super.restoreSelectedEditor();
  }
}
 
Example #13
Source File: HeaderHidingTabbedModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void selectEditor(String displayName) {
  if (displayName != null) {
    ModuleConfigurationEditor singleEditor = getSingleEditor();
    if (singleEditor != null) {
      // TODO [ksafonov] commented until IDEA-73889 is implemented
      //assert singleEditor.getDisplayName().equals(displayName);
    }
    else {
      super.selectEditor(displayName);
    }
  }
}
 
Example #14
Source File: HeaderHidingTabbedModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected JComponent createCenterPanel() {
  ModuleConfigurationEditor singleEditor = getSingleEditor();
  if (singleEditor != null) {
    final JComponent component = singleEditor.createComponent();
    singleEditor.reset();
    return component;
  }
  else {
    return super.createCenterPanel();
  }
}
 
Example #15
Source File: ModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getHelpTopic() {
  if (myEditors.isEmpty()) {
    return null;
  }
  final ModuleConfigurationEditor selectedEditor = getSelectedEditor();
  return selectedEditor != null ? selectedEditor.getHelpTopic() : null;
}
 
Example #16
Source File: ModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void canApply() throws ConfigurationException {
  for (ModuleConfigurationEditor editor : myEditors) {
    if (editor instanceof ModuleElementsEditor) {
      ((ModuleElementsEditor)editor).canApply();
    }
  }
}
 
Example #17
Source File: OCamlDefaultModuleEditorsProvider.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@NotNull
@Override
public ModuleConfigurationEditor[] createEditors(@NotNull ModuleConfigurationState state) {
    Module module = state.getRootModel().getModule();
    if (ModuleType.get(module) instanceof OCamlModuleType) {
        return new ModuleConfigurationEditor[]{
                new OCamlContentEntriesEditor(module.getName(), state)
        };
    }

    return ModuleConfigurationEditor.EMPTY;
}
 
Example #18
Source File: ModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void updateCompilerOutputPathChanged(String baseUrl, String moduleName){
  if (myGenericSettingsPanel == null) return; //wasn't initialized yet
  for (final ModuleConfigurationEditor myEditor : myEditors) {
    if (myEditor instanceof ModuleElementsEditor) {
      ((ModuleElementsEditor)myEditor).moduleCompileOutputChanged(baseUrl, moduleName);
    }
  }
}
 
Example #19
Source File: ModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void fireModuleStateChanged() {
  if (getModule() != null) { //module with attached module libraries was deleted
    getPanel();  //init editor if needed
    for (final ModuleConfigurationEditor myEditor : myEditors) {
      myEditor.moduleStateChanged();
    }
    myEventDispatcher.getMulticaster().moduleStateChanged(getModifiableRootModelProxy());
  }
}
 
Example #20
Source File: ModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean isModified() {
  for (ModuleConfigurationEditor moduleElementsEditor : myEditors) {
    if (moduleElementsEditor.isModified()) {
      return true;
    }
  }
  return false;
}
 
Example #21
Source File: ModuleEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void init(History history) {
  myHistory = history;

  for (ModuleConfigurationEditor each : myEditors) {
    if (each instanceof ModuleElementsEditor) {
      ((ModuleElementsEditor)each).setHistory(myHistory);
    }
  }

  restoreSelectedEditor();
}
 
Example #22
Source File: HaxeModuleConfigurationEditorProvider.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
public ModuleConfigurationEditor[] createEditors(final ModuleConfigurationState state) {
  final Module module = state.getRootModel().getModule();
  if (ModuleType.get(module) != HaxeModuleType.getInstance()) {
    return ModuleConfigurationEditor.EMPTY;
  }
  return new ModuleConfigurationEditor[]{
    new CommonContentEntriesEditor(module.getName(), state, JavaSourceRootType.SOURCE, JavaSourceRootType.TEST_SOURCE),
    new ClasspathEditor(state),
    new HaxeModuleConfigurationEditor(state)
  };
}
 
Example #23
Source File: HaskellModuleConfigurationEditor.java    From intellij-haskforce with Apache License 2.0 5 votes vote down vote up
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
    Module module = state.getRootModel().getModule();
    if (!(ModuleType.get(module) instanceof HaskellModuleType)) {
        return ModuleConfigurationEditor.EMPTY;
    }
    return new ModuleConfigurationEditor[]{
            new JavaContentEntriesEditor(module.getName(), state),
            // new CabalFilesEditor(state),
            new ClasspathEditor(state),
    };
}
 
Example #24
Source File: HeaderHidingTabbedModuleEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
private ModuleConfigurationEditor getSingleEditor() {
  return myEditors.size() == 1 ? myEditors.get(0) : null;
}
 
Example #25
Source File: HeaderHidingTabbedModuleEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public ModuleConfigurationEditor getSelectedEditor() {
  ModuleConfigurationEditor singleEditor = getSingleEditor();
  return singleEditor != null ? singleEditor : super.getSelectedEditor();
}
 
Example #26
Source File: ModuleEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public abstract ModuleConfigurationEditor getEditor(@Nonnull String displayName);
 
Example #27
Source File: ModuleEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public abstract ModuleConfigurationEditor getSelectedEditor();