Java 类com.intellij.ui.roots.ToolbarPanel 实例源码

项目:tools-idea    文件:ContentEntryTreeEditor.java   
public ContentEntryTreeEditor(Project project, boolean canMarkSources, boolean canMarkTestSources) {
  myProject = project;
  myCanMarkSources = canMarkSources;
  myCanMarkTestSources = canMarkTestSources;
  myTree = new Tree();
  myTree.setRootVisible(true);
  myTree.setShowsRootHandles(true);

  myEditingActionsGroup = new DefaultActionGroup();

  TreeUtil.installActions(myTree);
  new TreeSpeedSearch(myTree);

  myTreePanel = new MyPanel(new BorderLayout());
  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
  myTreePanel.add(new ToolbarPanel(scrollPane, myEditingActionsGroup), BorderLayout.CENTER);

  myTreePanel.setVisible(false);
  myDescriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor();
  myDescriptor.setShowFileSystemRoots(false);
}
项目:android-codegenerator-plugin-intellij    文件:TemplateConfigurable.java   
@Nullable
@Override
public JComponent createComponent() {
    templateSettings = TemplateSettings.getInstance();
    editor = createEditorInPanel(templateSettings.provideTemplateForName(templateName));

    JPanel panel = new JPanel(new BorderLayout());
    panel.setPreferredSize(new Dimension(400, 300));
    panel.add(SeparatorFactory.createSeparator(templateHeaderText, null), BorderLayout.PAGE_START);
    panel.add(new ToolbarPanel(editorPanel, new DefaultActionGroup(new ResetToDefaultAction())), BorderLayout.CENTER);
    return panel;
}
项目:intellij-ce-playground    文件:CommonContentEntriesEditor.java   
@Override
public JPanel createComponentImpl() {
  final Module module = getModule();
  final Project project = module.getProject();

  myContentEntryEditorListener = new MyContentEntryEditorListener();

  final JPanel mainPanel = new JPanel(new BorderLayout());
  if (!Registry.is("ide.new.project.settings")) {
    mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
  }

  addAdditionalSettingsToPanel(mainPanel);

  final JPanel entriesPanel = new JPanel(new BorderLayout());

  final DefaultActionGroup group = new DefaultActionGroup();
  final AddContentEntryAction action = new AddContentEntryAction();
  action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);
  group.add(action);

  myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());
  myEditorsPanel.setBackground(BACKGROUND_COLOR);
  JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel, Registry.is("ide.new.project.settings"));
  final ToolbarPanel toolbarPanel = new ToolbarPanel(myScrollPane, group);
  if (Registry.is("ide.new.project.settings")) {
    toolbarPanel.setBorder(new CustomLineBorder(1,0,0,0));
  }
  entriesPanel.add(toolbarPanel, BorderLayout.CENTER);

  final JBSplitter splitter = Registry.is("ide.new.project.settings") ? new OnePixelSplitter(false) : new JBSplitter(false);
  splitter.setProportion(0.6f);
  splitter.setHonorComponentsMinimumSize(true);

  myRootTreeEditor = createContentEntryTreeEditor(project);
  final JComponent component = myRootTreeEditor.createComponent();
  if (Registry.is("ide.new.project.settings")) {
    component.setBorder(new CustomLineBorder(1,0,0,0));
  }

  splitter.setFirstComponent(component);
  splitter.setSecondComponent(entriesPanel);
  JPanel contentPanel = new JPanel(new GridBagLayout());
  if (!Registry.is("ide.new.project.settings")) {
    contentPanel.setBorder(BorderFactory.createEtchedBorder());
  }
  final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myRootTreeEditor.getEditingActionsGroup(), true);
  contentPanel.add(new JLabel("Mark as:"),
                   new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, 0, new Insets(0, 10, 0, 10), 0, 0));
  contentPanel.add(actionToolbar.getComponent(),
                   new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                                          new Insets(0, 0, 0, 0), 0, 0));
  contentPanel.add(splitter,
                   new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
                                          new Insets(0, 0, 0, 0), 0, 0));

  mainPanel.add(contentPanel, BorderLayout.CENTER);


  final JPanel innerPanel = createBottomControl(module);
  if (innerPanel != null) {
    mainPanel.add(innerPanel, BorderLayout.SOUTH);
  }

  final ModifiableRootModel model = getModel();
  if (model != null) {
    final ContentEntry[] contentEntries = model.getContentEntries();
    if (contentEntries.length > 0) {
      for (final ContentEntry contentEntry : contentEntries) {
        addContentEntryPanel(contentEntry.getUrl());
      }
      selectContentEntry(contentEntries[0].getUrl());
    }
  }

  return mainPanel;
}
项目:tools-idea    文件:CommonContentEntriesEditor.java   
@Override
public JPanel createComponentImpl() {
  final Module module = getModule();
  final Project project = module.getProject();

  myContentEntryEditorListener = new MyContentEntryEditorListener();

  final JPanel mainPanel = new JPanel(new BorderLayout());
  mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));

  addAdditionalSettingsToPanel(mainPanel);

  final JPanel entriesPanel = new JPanel(new BorderLayout());

  final DefaultActionGroup group = new DefaultActionGroup();
  final AddContentEntryAction action = new AddContentEntryAction();
  action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);
  group.add(action);

  myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());
  myEditorsPanel.setBackground(BACKGROUND_COLOR);
  JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel);
  entriesPanel.add(new ToolbarPanel(myScrollPane, group), BorderLayout.CENTER);

  final Splitter splitter = new Splitter(false);
  splitter.setHonorComponentsMinimumSize(true);
  mainPanel.add(splitter, BorderLayout.CENTER);

  final JPanel editorsPanel = new JPanel(new GridBagLayout());
  splitter.setFirstComponent(editorsPanel);
  editorsPanel.add(entriesPanel,
                   new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

  myRootTreeEditor = createContentEntryTreeEditor(project);
  final JComponent treeEditorComponent = myRootTreeEditor.createComponent();
  splitter.setSecondComponent(treeEditorComponent);

  final JPanel innerPanel = createBottomControl(module);
  if (innerPanel != null) {
    mainPanel.add(innerPanel, BorderLayout.SOUTH);
  }

  final ModifiableRootModel model = getModel();
  if (model != null) {
    final ContentEntry[] contentEntries = model.getContentEntries();
    if (contentEntries.length > 0) {
      for (final ContentEntry contentEntry : contentEntries) {
        addContentEntryPanel(contentEntry.getUrl());
      }
      selectContentEntry(contentEntries[0].getUrl());
    }
  }

  return mainPanel;
}
项目:consulo    文件:ContentEntriesEditor.java   
@Nonnull
@Override
public JPanel createComponentImpl() {
  final Module module = getModule();
  final Project project = module.getProject();

  myContentEntryEditorListener = new MyContentEntryEditorListener();

  final JPanel mainPanel = new JPanel(new BorderLayout());

  final JPanel entriesPanel = new JPanel(new BorderLayout());

  final DefaultActionGroup group = new DefaultActionGroup();
  final AddContentEntryAction action = new AddContentEntryAction();
  action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);
  group.add(action);

  myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());
  myEditorsPanel.setBackground(BACKGROUND_COLOR);
  JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel, true);
  entriesPanel.add(new ToolbarPanel(myScrollPane, group), BorderLayout.CENTER);

  final JBSplitter splitter = new OnePixelSplitter(false);
  splitter.setProportion(0.6f);
  splitter.setHonorComponentsMinimumSize(true);

  myRootTreeEditor = new ContentEntryTreeEditor(project, myState);
  JComponent component = myRootTreeEditor.createComponent();
  component.setBorder(new CustomLineBorder(JBUI.scale(1),0,0,0));

  splitter.setFirstComponent(component);
  splitter.setSecondComponent(entriesPanel);
  JPanel contentPanel = new JPanel(new GridBagLayout());

  final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myRootTreeEditor.getEditingActionsGroup(), true);
  contentPanel.add(new JLabel("Mark as:"),
                   new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, 0, new JBInsets(0, 5, 0, 5), 0,
                                          0));
  contentPanel.add(actionToolbar.getComponent(),
                   new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                                          new JBInsets(0, 0, 0, 0), 0, 0));
  contentPanel.add(splitter,
                   new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
                                          new JBInsets(0, 0, 0, 0), 0, 0));

  mainPanel.add(contentPanel, BorderLayout.CENTER);

  final ModifiableRootModel model = getModel();
  if (model != null) {
    final ContentEntry[] contentEntries = model.getContentEntries();
    if (contentEntries.length > 0) {
      for (final ContentEntry contentEntry : contentEntries) {
        addContentEntryPanel(contentEntry);
      }
      selectContentEntry(contentEntries[0]);
    }
  }

  return mainPanel;
}