consulo.module.extension.swing.SwingMutableModuleExtension Java Examples

The following examples show how to use consulo.module.extension.swing.SwingMutableModuleExtension. 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: ExtensionEditor.java    From consulo with 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;
}