• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.atest.toolWindow;
17 
18 import com.intellij.openapi.project.Project;
19 import com.intellij.openapi.wm.ToolWindow;
20 import com.intellij.openapi.wm.ToolWindowFactory;
21 import com.intellij.ui.content.Content;
22 import com.intellij.ui.content.ContentFactory;
23 import org.jetbrains.annotations.NotNull;
24 
25 /** Performs lazy initialization of Atest toolwindow registered in plugin.xml. */
26 public class AtestToolWindowFactory implements ToolWindowFactory {
27 
28     /**
29      * Creates the Atest tool window content.
30      *
31      * @param project an object that represents an IntelliJ project.
32      * @param toolWindow a child window of the IDE used to display information.
33      */
34     @Override
createToolWindowContent(@otNull Project project, @NotNull ToolWindow toolWindow)35     public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
36         AtestToolWindow atestToolWindow = AtestToolWindow.initAtestToolWindow(toolWindow, project);
37         ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
38         Content toolWindowContent =
39                 contentFactory.createContent(atestToolWindow.getContent(), "", true);
40         toolWindow.getContentManager().addContent(toolWindowContent);
41     }
42 }
43