Example usage for com.intellij.openapi.wm ToolWindowId ANT_BUILD

List of usage examples for com.intellij.openapi.wm ToolWindowId ANT_BUILD

Introduction

In this page you can find the example usage for com.intellij.openapi.wm ToolWindowId ANT_BUILD.

Prototype

String ANT_BUILD

To view the source code for com.intellij.openapi.wm ToolWindowId ANT_BUILD.

Click Source Link

Usage

From source file:com.intellij.lang.ant.config.actions.AddAntBuildFile.java

License:Apache License

public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();//from  ww w .jav  a 2 s  .  c  o m
    VirtualFile file = e.getData(PlatformDataKeys.VIRTUAL_FILE);
    AntConfiguration antConfiguration = AntConfiguration.getInstance(project);
    try {
        antConfiguration.addBuildFile(file);
        ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.ANT_BUILD).activate(null);
    } catch (AntNoFileException ex) {
        String message = ex.getMessage();
        if (message == null || message.length() == 0) {
            message = AntBundle.message("cannot.add.build.files.from.excluded.directories.error.message",
                    ex.getFile().getPresentableUrl());
        }

        Messages.showWarningDialog(project, message, AntBundle.message("cannot.add.build.file.dialog.title"));
    }
}

From source file:org.napile.idea.thermit.config.actions.ThermitAntBuildFile.java

License:Apache License

public void actionPerformed(AnActionEvent event) {
    DataContext dataContext = event.getDataContext();
    Project project = PlatformDataKeys.PROJECT.getData(dataContext);
    VirtualFile file = PlatformDataKeys.VIRTUAL_FILE.getData(dataContext);
    ThermitConfiguration thermitConfiguration = ThermitConfiguration.getInstance(project);
    try {/*from  ww w  .j  a v a  2  s .  c  om*/
        thermitConfiguration.addBuildFile(file);
        ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.ANT_BUILD).activate(null);
    } catch (AntNoFileException e) {
        String message = e.getMessage();
        if (message == null || message.length() == 0) {
            message = ThermitBundle.message("cannot.add.build.files.from.excluded.directories.error.message",
                    e.getFile().getPresentableUrl());
        }

        Messages.showWarningDialog(project, message,
                ThermitBundle.message("cannot.add.build.file.dialog.title"));
    }
}