Search in sources :

Example 1 with IconActionComponent

use of com.intellij.ui.roots.IconActionComponent in project intellij-community by JetBrains.

the class JavaSourceRootEditHandlerBase method createPropertiesEditor.

@Nullable
@Override
public JComponent createPropertiesEditor(@NotNull final SourceFolder folder, @NotNull final JComponent parentComponent, @NotNull final ContentRootPanel.ActionCallback callback) {
    final IconActionComponent iconComponent = new IconActionComponent(AllIcons.Modules.SetPackagePrefix, AllIcons.Modules.SetPackagePrefixRollover, ProjectBundle.message("module.paths.edit.properties.tooltip"), () -> {
        JavaSourceRootProperties properties = folder.getJpsElement().getProperties(JavaModuleSourceRootTypes.SOURCES);
        assert properties != null;
        SourceRootPropertiesDialog dialog = new SourceRootPropertiesDialog(parentComponent, properties);
        if (dialog.showAndGet()) {
            callback.onSourceRootPropertiesChanged(folder);
        }
    });
    final JPanel panel = new JPanel(new BorderLayout());
    panel.setOpaque(false);
    panel.add(iconComponent, BorderLayout.CENTER);
    panel.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    return panel;
}
Also used : IconActionComponent(com.intellij.ui.roots.IconActionComponent) JavaSourceRootProperties(org.jetbrains.jps.model.java.JavaSourceRootProperties) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with IconActionComponent

use of com.intellij.ui.roots.IconActionComponent in project intellij-community by JetBrains.

the class JavaResourceRootEditHandlerBase method createPropertiesEditor.

@Nullable
@Override
public JComponent createPropertiesEditor(@NotNull final SourceFolder folder, @NotNull final JComponent parentComponent, @NotNull final ContentRootPanel.ActionCallback callback) {
    final IconActionComponent iconComponent = new IconActionComponent(AllIcons.Modules.SetPackagePrefix, AllIcons.Modules.SetPackagePrefixRollover, ProjectBundle.message("module.paths.edit.properties.tooltip"), () -> {
        JavaResourceRootProperties properties = folder.getJpsElement().getProperties(JavaModuleSourceRootTypes.RESOURCES);
        assert properties != null;
        ResourceRootPropertiesDialog dialog = new ResourceRootPropertiesDialog(parentComponent, properties);
        if (dialog.showAndGet()) {
            callback.onSourceRootPropertiesChanged(folder);
        }
    });
    final JPanel panel = new JPanel(new BorderLayout());
    panel.setOpaque(false);
    panel.add(iconComponent, BorderLayout.CENTER);
    panel.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
    return panel;
}
Also used : JavaResourceRootProperties(org.jetbrains.jps.model.java.JavaResourceRootProperties) IconActionComponent(com.intellij.ui.roots.IconActionComponent) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with IconActionComponent

use of com.intellij.ui.roots.IconActionComponent in project intellij-community by JetBrains.

the class ContentRootPanel method createHeader.

private JComponent createHeader() {
    final JPanel panel = new JPanel(new GridBagLayout());
    final JLabel headerLabel = new JLabel(toDisplayPath(getContentEntry().getUrl()));
    headerLabel.setFont(headerLabel.getFont().deriveFont(Font.BOLD));
    headerLabel.setOpaque(false);
    if (getContentEntry().getFile() == null) {
        headerLabel.setForeground(JBColor.RED);
    }
    final IconActionComponent deleteIconComponent = new IconActionComponent(AllIcons.Modules.DeleteContentRoot, AllIcons.Modules.DeleteContentRootRollover, ProjectBundle.message("module.paths.remove.content.tooltip"), () -> myCallback.deleteContentEntry());
    final ResizingWrapper wrapper = new ResizingWrapper(headerLabel);
    panel.add(wrapper, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insetsLeft(2), 0, 0));
    panel.add(deleteIconComponent, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, JBUI.insetsRight(5), 0, 0));
    FilePathClipper.install(headerLabel, wrapper);
    return panel;
}
Also used : ResizingWrapper(com.intellij.ui.roots.ResizingWrapper) IconActionComponent(com.intellij.ui.roots.IconActionComponent)

Aggregations

IconActionComponent (com.intellij.ui.roots.IconActionComponent)3 Nullable (org.jetbrains.annotations.Nullable)2 ResizingWrapper (com.intellij.ui.roots.ResizingWrapper)1 JavaResourceRootProperties (org.jetbrains.jps.model.java.JavaResourceRootProperties)1 JavaSourceRootProperties (org.jetbrains.jps.model.java.JavaSourceRootProperties)1