use of com.intellij.ide.impl.TypeSafeDataProviderAdapter in project intellij-community by JetBrains.
the class ArtifactEditorImpl method createMainComponent.
public JComponent createMainComponent() {
mySourceItemsTree.initTree();
myLayoutTreeComponent.initTree();
DataManager.registerDataProvider(myMainPanel, new TypeSafeDataProviderAdapter(new MyDataProvider()));
myErrorPanelPlace.add(myValidationManager.getMainErrorPanel(), BorderLayout.CENTER);
final JBSplitter splitter = new OnePixelSplitter(false);
final JPanel leftPanel = new JPanel(new BorderLayout());
JPanel treePanel = myLayoutTreeComponent.getTreePanel();
if (UIUtil.isUnderDarcula()) {
treePanel.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
treePanel.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
leftPanel.add(treePanel, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
CompoundBorder border = new CompoundBorder(new CustomLineBorder(0, 0, 0, 1), BorderFactory.createEmptyBorder(0, 0, 0, 0));
leftPanel.setBorder(border);
} else {
leftPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 0));
}
splitter.setFirstComponent(leftPanel);
final JPanel rightPanel = new JPanel(new BorderLayout());
final JPanel rightTopPanel = new JPanel(new BorderLayout());
final JPanel labelPanel = new JPanel();
labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.X_AXIS));
labelPanel.add(new JLabel("Available Elements "));
final HyperlinkLabel link = new HyperlinkLabel("");
link.setIcon(AllIcons.General.Help_small);
link.setUseIconAsLink(true);
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
final JLabel label = new JLabel(ProjectBundle.message("artifact.source.items.tree.tooltip"));
label.setBorder(HintUtil.createHintBorder());
label.setBackground(HintUtil.getInformationColor());
label.setOpaque(true);
HintManager.getInstance().showHint(label, RelativePoint.getSouthWestOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1);
}
});
labelPanel.add(link);
rightTopPanel.add(labelPanel, BorderLayout.CENTER);
rightPanel.add(rightTopPanel, BorderLayout.NORTH);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(mySourceItemsTree, true);
JPanel scrollPaneWrap = new JPanel(new BorderLayout());
scrollPaneWrap.add(scrollPane, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
scrollPaneWrap.setBorder(new EmptyBorder(3, 0, 0, 0));
} else {
scrollPaneWrap.setBorder(new LineBorder(UIUtil.getBorderColor()));
}
rightPanel.add(scrollPaneWrap, BorderLayout.CENTER);
if (UIUtil.isUnderDarcula()) {
rightPanel.setBorder(new CompoundBorder(new CustomLineBorder(0, 1, 0, 0), BorderFactory.createEmptyBorder(0, 0, 0, 0)));
} else {
rightPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3));
}
splitter.setSecondComponent(rightPanel);
splitter.getDivider().setBackground(UIUtil.getPanelBackground());
treePanel.setBorder(JBUI.Borders.empty());
rightPanel.setBorder(JBUI.Borders.empty());
scrollPaneWrap.setBorder(JBUI.Borders.empty());
leftPanel.setBorder(JBUI.Borders.empty());
myShowContentCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final ThreeStateCheckBox.State state = myShowContentCheckBox.getState();
if (state == ThreeStateCheckBox.State.SELECTED) {
mySubstitutionParameters.setSubstituteAll();
} else if (state == ThreeStateCheckBox.State.NOT_SELECTED) {
mySubstitutionParameters.setSubstituteNone();
}
myShowContentCheckBox.setThirdStateEnabled(false);
myLayoutTreeComponent.rebuildTree();
onShowContentSettingsChanged();
}
});
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, createToolbarActionGroup(), true);
JComponent toolbarComponent = toolbar.getComponent();
if (UIUtil.isUnderDarcula()) {
toolbarComponent.setBorder(new CustomLineBorder(0, 0, 1, 0));
}
leftPanel.add(toolbarComponent, BorderLayout.NORTH);
toolbar.updateActionsImmediately();
rightTopPanel.setPreferredSize(new Dimension(-1, toolbarComponent.getPreferredSize().height));
myTabbedPane = new TabbedPaneWrapper(this);
myTabbedPane.addTab("Output Layout", splitter);
myPropertiesEditors.addTabs(myTabbedPane);
myEditorPanel.add(myTabbedPane.getComponent(), BorderLayout.CENTER);
final LayoutTree tree = myLayoutTreeComponent.getLayoutTree();
new ShowAddPackagingElementPopupAction(this).registerCustomShortcutSet(CommonShortcuts.getNew(), tree);
PopupHandler.installPopupHandler(tree, createPopupActionGroup(), ActionPlaces.UNKNOWN, ActionManager.getInstance());
ToolTipManager.sharedInstance().registerComponent(tree);
rebuildTries();
return getMainComponent();
}
Aggregations