本文整理匯總了Java中com.intellij.ui.content.ContentFactory類的典型用法代碼示例。如果您正苦於以下問題:Java ContentFactory類的具體用法?Java ContentFactory怎麽用?Java ContentFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ContentFactory類屬於com.intellij.ui.content包,在下文中一共展示了ContentFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createToolWindowContent
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Set<SelectedExchangeCurrencyPair> selectedExchangeCurrencyPairs = IdeaCurrencyConfig.getInstance().getSelectedExchangeCurrencyPairs();
if (IdeaCurrencyConfig.getInstance().getActive()) {
List<TickerDto> data = IdeaCurrencyApp.getInstance().getTickers(selectedExchangeCurrencyPairs);
fillData(data);
}
Content content = contentFactory.createContent(contentPane, "", false);
toolWindow.getContentManager().addContent(content);
MessageBus messageBus = project.getMessageBus();
messageBusConnection = messageBus.connect();
messageBusConnection.subscribe(ConfigChangeNotifier.CONFIG_TOPIC, active -> {
if (active) {
scheduleNextTask();
}
});
}
示例2: createTerminalInContentPanel
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
/**
* Create a terminal panel
*
* @param terminalRunner
* @param toolWindow
* @return
*/
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(true);
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
content.setCloseable(true);
myTerminalWidget = terminalRunner.createTerminalWidget(content);
panel.setContent(myTerminalWidget.getComponent());
panel.addFocusListener(this);
createToolbar(terminalRunner, myTerminalWidget, toolWindow, panel);// west toolbar
ActionToolbar toolbar = createTopToolbar(terminalRunner, myTerminalWidget, toolWindow);
toolbar.setTargetComponent(panel);
panel.setToolbar(toolbar.getComponent(), false);
content.setPreferredFocusableComponent(myTerminalWidget.getComponent());
return content;
}
示例3: createToolWindowContent
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull ToolWindow toolWindow) {
SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
BsConsole console = new BsConsole(project);
panel.setContent(console.getComponent());
ActionToolbar toolbar = console.createToolbar();
panel.setToolbar(toolbar.getComponent());
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", true);
toolWindow.getContentManager().addContent(content);
// Start compiler
BsCompiler bsc = BucklescriptProjectComponent.getInstance(project).getCompiler();
if (bsc != null) {
bsc.addListener(new BsOutputListener(project));
ProcessHandler handler = bsc.getHandler();
if (handler == null) {
console.print("Bsb not found, check the event logs.", ERROR_OUTPUT);
} else {
console.attachToProcess(handler);
}
bsc.startNotify();
}
}
示例4: createChat
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
private void createChat(MMUserStatus user) throws IOException, URISyntaxException {
Channel.ChannelData channel = client.createChat(user.userId());
if (channel == null) {
Notifications.Bus.notify(new Notification("mattermost", "channel error", "no channel found for " + user.username(), NotificationType.ERROR));
return;
}
SwingUtilities.invokeLater(() -> {
String name = user.username();
Chat chat = this.channelIdChatMap.computeIfAbsent(channel.getId(), k -> new Chat());
chat.channelId = channel.getId();
if (this.toolWindow.getContentManager().getContent(chat) == null) {
Content messages = ContentFactory.SERVICE.getInstance().createContent(chat, name, false);
messages.setIcon(TEAM);
this.toolWindow.getContentManager().addContent(messages);
this.toolWindow.getContentManager().setSelectedContent(messages);
} else {
Content c = this.toolWindow.getContentManager().getContent(chat);
this.toolWindow.getContentManager().setSelectedContent(c);
}
SwingUtilities.invokeLater(chat.inputArea::grabFocus);
});
}
示例5: initFacet
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
@Override
public void initFacet() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ToolWindowManager manager = ToolWindowManager.getInstance(MuleFacet.this.getModule().getProject());
List<String> ids = Arrays.asList(manager.getToolWindowIds());
if (manager.getToolWindow("Global Configs") == null && !ids.contains("Global Configs")) {
try {
ToolWindow toolWindow = manager.registerToolWindow("Global Configs", true, ToolWindowAnchor.LEFT, false);
toolWindow.setIcon(MuleIcons.MuleIcon);
GlobalConfigsToolWindowPanel toolWindowPanel = new GlobalConfigsToolWindowPanel(MuleFacet.this.getModule().getProject());
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(toolWindowPanel, "", true);
toolWindow.getContentManager().addContent(content);
} catch (Exception e) {
logger.error("Unable to initialize toolWindow: ", e);
}
}
}
});
}
示例6: createWindow
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
public void createWindow(Project project) {
jFXPanel = new JFXPanel();
ToolWindow toolWindow = ToolWindowManager.getInstance(project).registerToolWindow("Basis.js", false, ToolWindowAnchor.BOTTOM, false);
toolWindow.setIcon(IconLoader.getIcon("/icons/basisjs.png"));
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(jFXPanel, "inspector", false);
toolWindow.getContentManager().addContent(content);
InspectorController sceneInspectorController = new InspectorController();
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("/com/basisjs/ui/windows/tools/inspector/InspectorScene.fxml"));
fxmlLoader.setController(sceneInspectorController);
Platform.setImplicitExit(false);
PlatformImpl.runLater(() -> {
try {
Scene scene = new Scene(fxmlLoader.load());
jFXPanel.setScene(scene);
webView = sceneInspectorController.webView;
webView.setContextMenuEnabled(false);
} catch (IOException e) {
e.printStackTrace();
}
});
}
示例7: buildGUI
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
public SearchToolWindowGUI buildGUI(@NotNull ToolWindow toolWindow, Project project) {
SearchToolWindowGUI windowGUI = null;
JPanel jPanel;
if(isJavaFXAvailable()) {
windowGUI = new SearchToolWindowGUI.SearchToolWindowGUIBuilder()
.setContent(content)
.setProject(project)
.setSearchModel(project.getComponent(UserTagStatComponent.class).getSearchModel()).build();
jPanel = windowGUI.getContentPanel();
} else {
jPanel = getNoJavaFXFoundPanel();
}
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content windowContent = contentFactory.createContent(jPanel, "", false);
toolWindow.getContentManager().addContent(windowContent);
return windowGUI;
}
示例8: analyze
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
public void analyze() {
final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, myScope);
final Runnable process = new Runnable() {
public void run() {
builder.analyze();
}
};
final Runnable successRunnable = new Runnable() {
public void run() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
CyclicDependenciesPanel panel = new CyclicDependenciesPanel(myProject, builder);
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, AnalysisScopeBundle.message(
"action.analyzing.cyclic.dependencies.in.scope", builder.getScope().getDisplayName()), false);
content.setDisposer(panel);
panel.setContent(content);
DependenciesToolWindow.getInstance(myProject).addContent(content);
}
});
}
};
ProgressManager.getInstance()
.runProcessWithProgressAsynchronously(myProject, AnalysisScopeBundle.message("package.dependencies.progress.title"),
process, successRunnable, null, new PerformAnalysisInBackgroundOption(myProject));
}
示例9: createConsole
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
private void createConsole(@NotNull final NetService netService) {
TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject());
netService.configureConsole(consoleBuilder);
console = consoleBuilder.getConsole();
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ActionGroup actionGroup = netService.getConsoleToolWindowActions();
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);
SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
toolWindowPanel.setContent(console.getComponent());
toolWindowPanel.setToolbar(toolbar.getComponent());
ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject())
.registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true);
toolWindow.setIcon(netService.getConsoleToolWindowIcon());
Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, "", false);
Disposer.register(content, console);
toolWindow.getContentManager().addContent(content);
}
}, netService.getProject().getDisposed());
}
示例10: openMessagesView
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) {
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(myProject, new Runnable() {
public void run() {
final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
messageView.runWhenInitialized(new Runnable() {
public void run() {
final Content content =
ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
messageView.getContentManager().addContent(content);
Disposer.register(content, errorTreeView);
messageView.getContentManager().setSelectedContent(content);
removeContents(content, tabDisplayName);
ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
}
});
}
}, VcsBundle.message("command.name.open.error.message.view"), null);
}
示例11: openMessagesView
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView,
@NotNull final Project myProject,
@NotNull final String tabDisplayName) {
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(myProject, new Runnable() {
@Override
public void run() {
final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
messageView.getContentManager().addContent(content);
Disposer.register(content, errorTreeView);
messageView.getContentManager().setSelectedContent(content);
removeContents(content, myProject, tabDisplayName);
}
}, "Open message view", null);
}
示例12: onSuccess
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
private void onSuccess(final List<DependenciesBuilder> builders) {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (shouldShowDependenciesPanel(builders)) {
final String displayName = getPanelDisplayName(builders.get(0).getScope());
DependenciesPanel panel = new DependenciesPanel(myProject, builders, myExcluded);
Content content = ContentFactory.SERVICE.getInstance().createContent(panel, displayName, false);
content.setDisposer(panel);
panel.setContent(content);
DependenciesToolWindow.getInstance(myProject).addContent(content);
}
}
});
}
示例13: createToolWindowContent
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
//Create runner UI layout
RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null);
AnAction[] consoleActions = myConsoleView.createConsoleActions();
for (AnAction action : consoleActions) {
if (!shouldIgnoreAction(action)) {
group.add(action);
}
}
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
JComponent layoutComponent = layoutUi.getComponent();
myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
//noinspection ConstantConditions
Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
toolWindow.getContentManager().addContent(content);
}
示例14: showSkipped
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
/**
* Show skipped commits
*
* @param project the context project
* @param skippedCommits the skipped commits
*/
public static void showSkipped(final Project project, final SortedMap<VirtualFile, List<GitRebaseUtils.CommitInfo>> skippedCommits) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
ContentManager contentManager = ProjectLevelVcsManagerEx.getInstanceEx(project).getContentManager();
if (contentManager == null) {
return;
}
GitSkippedCommits skipped = new GitSkippedCommits(contentManager, project, skippedCommits);
Content content = ContentFactory.SERVICE.getInstance().createContent(skipped, "Skipped Commits", true);
ContentsUtil.addContent(contentManager, content, true);
ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS).activate(null);
}
});
}
示例15: actionPerformed
import com.intellij.ui.content.ContentFactory; //導入依賴的package包/類
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) {
RepositoryBrowserDialog dialog = new RepositoryBrowserDialog(ProjectManager.getInstance().getDefaultProject());
dialog.show();
}
else {
ToolWindowManager manager = ToolWindowManager.getInstance(project);
ToolWindow w = manager.getToolWindow(REPOSITORY_BROWSER_TOOLWINDOW);
if (w == null) {
RepositoryToolWindowPanel component = new RepositoryToolWindowPanel(project);
w = manager.registerToolWindow(REPOSITORY_BROWSER_TOOLWINDOW, true, ToolWindowAnchor.BOTTOM, project, true);
final Content content = ContentFactory.SERVICE.getInstance().createContent(component, "", false);
Disposer.register(content, component);
w.getContentManager().addContent(content);
}
w.show(null);
w.activate(null);
}
}