public JComponent createComponentImpl() {
    myPanel = new ClasspathPanelImpl(getState());

    myPanel.addListener(
        new OrderPanelListener() {
          public void entryMoved() {
            flushChangesToModel();
          }
        });

    final JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    panel.add(myPanel, BorderLayout.CENTER);

    final ModuleJdkConfigurable jdkConfigurable =
        new ModuleJdkConfigurable(
            this, ProjectStructureConfigurable.getInstance(myProject).getProjectJdksModel()) {
          @Override
          protected ModifiableRootModel getRootModel() {
            return getState().getRootModel();
          }
        };
    panel.add(jdkConfigurable.createComponent(), BorderLayout.NORTH);
    jdkConfigurable.reset();
    registerDisposable(jdkConfigurable);

    List<ClasspathStorageProvider> providers = ClasspathStorage.getProviders();
    if (providers.size() > 1) {
      myClasspathFormatPanel = new ClasspathFormatPanel(providers);
      panel.add(myClasspathFormatPanel, BorderLayout.SOUTH);
    }

    return panel;
  }
Exemplo n.º 2
0
 @Override
 public void canApply() throws ConfigurationException {
   super.canApply();
   if (myClasspathFormatPanel != null) {
     final String storageID = myClasspathFormatPanel.getSelectedClasspathFormat();
     ClasspathStorage.getProvider(storageID).assertCompatible(getModel());
   }
 }
  @Nullable
  static String getID(PsiElement place, String alternativeID) {
    if (alternativeID != null) {
      final Module module = ModuleUtilCore.findModuleForPsiElement(place);
      if (module != null) {
        if (!ClasspathStorage.getStorageType(module).equals(ClasspathStorage.DEFAULT_STORAGE)) {
          return alternativeID;
        }
      }
    }

    return null;
  }
Exemplo n.º 4
0
 private void setModuleFilePath(String newFilePath) {
   ClasspathStorage.modulePathChanged(ModuleImpl.this, newFilePath);
   getMainStorage(ModuleImpl.this).setFile(null, new File(newFilePath));
   ComponentsPackage.getStateStore(ModuleImpl.this)
       .setPath(FileUtilRt.toSystemIndependentName(newFilePath));
 }
Exemplo n.º 5
0
 void apply() throws ConfigurationException {
   final String storageID = getSelectedClasspathFormat();
   ClasspathStorage.getProvider(storageID).assertCompatible(getModel());
   ClasspathStorage.setStorageType(getModel(), storageID);
 }
 @NotNull
 private String getModuleClasspathFormat() {
   return ClasspathStorage.getStorageType(getModel().getModule());
 }