Java Code Examples for consulo.module.extension.swing.SwingMutableModuleExtension

The following examples show how to use consulo.module.extension.swing.SwingMutableModuleExtension. These examples are extracted from open source projects. 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 Project: consulo   Source File: ExtensionEditor.java    License: Apache License 2.0 5 votes vote down vote up
@Nullable
@RequiredUIAccess
@SuppressWarnings("deprecation")
private JComponent createConfigurationPanel(final @Nonnull MutableModuleExtension extension) {
  myConfigurablePanelExtension = extension;
  @RequiredUIAccess Runnable updateOnCheck = () -> extensionChanged(extension);

  Disposable uiDisposable = Disposable.newDisposable("module extension: " + extension.getId());

  JComponent result = null;

  if (extension instanceof SwingMutableModuleExtension) {
    result = ((SwingMutableModuleExtension)extension).createConfigurablePanel(uiDisposable, updateOnCheck);
  }
  else {
    Component component = extension.createConfigurationComponent(uiDisposable, updateOnCheck);

    if (component != null) {
      if (component instanceof Layout) {
        component.removeBorders();

        component.addBorders(BorderStyle.EMPTY, null, 5);
      }

      result = (JComponent)TargetAWT.to(component);
    }
  }

  if (result != null) {
    myExtensionDisposables.put(result, uiDisposable);
  }

  return result;
}