Java源码示例:com.intellij.ui.SideBorder
示例1
private void setupOutputEditor() {
((EditorEx) m_outputEditor).getContentComponent().setFocusCycleRoot(false);
((EditorEx) m_outputEditor).setHorizontalScrollbarVisible(true);
((EditorEx) m_outputEditor).setVerticalScrollbarVisible(true);
((EditorEx) m_outputEditor).getScrollPane().setBorder(null);
EditorSettings editorSettings = ((EditorEx) m_outputEditor).getSettings();
editorSettings.setLineNumbersShown(false);
editorSettings.setIndentGuidesShown(false);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setFoldingOutlineShown(true);
editorSettings.setRightMarginShown(false);
editorSettings.setVirtualSpace(false);
editorSettings.setAdditionalPageAtBottom(false);
editorSettings.setAdditionalLinesCount(0);
editorSettings.setAdditionalColumnsCount(0);
editorSettings.setLineCursorWidth(1);
editorSettings.setCaretRowShown(false);
// output only editor
m_outputEditor.setRendererMode(true);
// tiny separation between output and prompt
m_outputEditor.getComponent().setBorder(new SideBorder(JBColor.LIGHT_GRAY, SideBorder.BOTTOM));
}
示例2
@Nonnull
private static SideBorder createTopBottomSideBorder(boolean top) {
return new SideBorder(null, top ? SideBorder.BOTTOM : SideBorder.TOP) {
@Override
public Color getLineColor() {
Color result = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.TEARLINE_COLOR);
return result == null ? JBColor.BLACK : result;
}
};
}
示例3
/**
* Launch process, setup history, actions etc.
*
* @throws ExecutionException
*/
public void initAndRun() throws ExecutionException {
// Create Server process
final Process process = createProcess();
UIUtil.invokeLaterIfNeeded(() -> {
// Init console view
myConsoleView = createConsoleView();
if (myConsoleView instanceof JComponent) {
((JComponent)myConsoleView).setBorder(new SideBorder(JBColor.border(), SideBorder.LEFT));
}
myProcessHandler = createProcessHandler(process);
myConsoleExecuteActionHandler = createExecuteActionHandler();
ProcessTerminatedListener.attach(myProcessHandler);
myProcessHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
finishConsole();
}
});
// Attach to process
myConsoleView.attachToProcess(myProcessHandler);
// Runner creating
createContentDescriptorAndActions();
// Run
myProcessHandler.startNotify();
});
}
示例4
/**
* Initialize the views
*/
public LogView(final Project project, @Nullable DeviceContext deviceContext, int defaultCycleBufferSize) {
myProject = project;
gistCreator = new GistCreator();
this.defaultCycleBufferSize = defaultCycleBufferSize;
logSourceManager = new LogSourceManager(project, deviceContext, this);
processFilter = Collections.newSetFromMap(new ConcurrentHashMap<LogProcess, Boolean>());
addFilters = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
removeFilters = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
logFormatter = new AndroidLogcatFormatter(AndroidLogcatPreferences.getInstance(project));
myLogConsole = new AndroidLogConsole(myProject, myLogFilterModel, logFormatter);
timer = new Timer(true);
//Update tasks
Runnable processUpdateTask = () -> {
processFilter.clear();
for (Object selection : processList.getSelectedValuesList()) {
processFilter.add((LogProcess) selection);
}
myLogConsole.refresh("Filtering process");
};
Runnable textUpdateTask = this::resetTextFilters;
Runnable levelUpdateTask = () -> myLogConsole.refresh("Applying level filters");
//initialize the process list
processList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
processListModel = new DefaultListModel<LogProcess>();
processList.setModel(processListModel);
processList.setCellRenderer(new ClientCellRenderer());
processList.addListSelectionListener(listSelectionEvent -> {
if (!listSelectionEvent.getValueIsAdjusting()) {
resetUpdateTimer(processUpdateTask);
}
});
//set up filters
textFilters.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent keyEvent) {
super.keyReleased(keyEvent);
resetUpdateTimer(textUpdateTask);
}
});
//level checkboxes
ItemListener levelChangeListener = itemEvent -> resetUpdateTimer(levelUpdateTask);
vCheckBox.addItemListener(levelChangeListener);
dCheckBox.addItemListener(levelChangeListener);
iCheckBox.addItemListener(levelChangeListener);
wCheckBox.addItemListener(levelChangeListener);
eCheckBox.addItemListener(levelChangeListener);
aCheckBox.addItemListener(levelChangeListener);
filterOpen = false;
splitPane.setDividerLocation(0);
splitPane.setDividerSize(0);
JComponent consoleComponent = myLogConsole.getComponent();
final ConsoleView console = myLogConsole.getConsole();
if (console != null) {
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("LogViewer",
getEditorActions(), false);
toolbar.setTargetComponent(console.getComponent());
final JComponent tbComp1 = toolbar.getComponent();
myPanel.add(tbComp1, BorderLayout.WEST);
}
logSourcePanel = new LogSourcePanel(deviceContext);
JPanel panel = logSourcePanel.getComponent();
panel.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
myPanel.add(panel, BorderLayout.NORTH);
editorPanel.add(consoleComponent, BorderLayout.CENTER);
Disposer.register(myProject, this);
Disposer.register(this, myLogConsole);
updateLogConsole();
DnDHandler dnDHandler = new DnDHandler(logSourceManager);
dnDHandler.addDndSupportForComponent(myPanel);
}
示例5
private void addInspectorViewContent(FlutterApp app, @Nullable InspectorService inspectorService, ToolWindow toolWindow) {
final ContentManager contentManager = toolWindow.getContentManager();
final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(true);
final JBRunnerTabs runnerTabs = new JBRunnerTabs(myProject, ActionManager.getInstance(), IdeFocusManager.getInstance(myProject), this);
runnerTabs.setSelectionChangeHandler(this::onTabSelectionChange);
final JPanel tabContainer = new JPanel(new BorderLayout());
final String tabName;
final FlutterDevice device = app.device();
if (device == null) {
tabName = app.getProject().getName();
}
else {
final List<FlutterDevice> existingDevices = new ArrayList<>();
for (FlutterApp otherApp : perAppViewState.keySet()) {
existingDevices.add(otherApp.device());
}
tabName = device.getUniqueName(existingDevices);
}
final Content content = contentManager.getFactory().createContent(null, tabName, false);
tabContainer.add(runnerTabs.getComponent(), BorderLayout.CENTER);
content.setComponent(tabContainer);
content.putUserData(ToolWindow.SHOW_CONTENT_ICON, Boolean.TRUE);
content.setIcon(FlutterIcons.Phone);
contentManager.addContent(content);
if (emptyContent != null) {
contentManager.removeContent(emptyContent, true);
emptyContent = null;
}
contentManager.setSelectedContent(content);
final PerAppState state = getOrCreateStateForApp(app);
assert (state.content == null);
state.content = content;
final DefaultActionGroup toolbarGroup = createToolbar(toolWindow, app, inspectorService);
toolWindowPanel.setToolbar(ActionManager.getInstance().createActionToolbar("FlutterViewToolbar", toolbarGroup, true).getComponent());
toolbarGroup.add(new OverflowAction(getOrCreateStateForApp(app), this, app));
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("InspectorToolbar", toolbarGroup, true);
final JComponent toolbarComponent = toolbar.getComponent();
toolbarComponent.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
tabContainer.add(toolbarComponent, BorderLayout.NORTH);
final boolean debugConnectionAvailable = app.getLaunchMode().supportsDebugConnection();
final boolean hasInspectorService = inspectorService != null;
// If the inspector is available (non-release mode), then show it.
if (debugConnectionAvailable) {
if (hasInspectorService) {
final boolean detailsSummaryViewSupported = inspectorService.isDetailsSummaryViewSupported();
addInspectorPanel(WIDGET_TAB_LABEL, runnerTabs, state, InspectorService.FlutterTreeType.widget, app, inspectorService, toolWindow,
toolbarGroup, true, detailsSummaryViewSupported);
addInspectorPanel(RENDER_TAB_LABEL, runnerTabs, state, InspectorService.FlutterTreeType.renderObject, app, inspectorService,
toolWindow, toolbarGroup, false, false);
}
else {
// If in profile mode, add disabled tabs for the inspector.
addDisabledTab(WIDGET_TAB_LABEL, runnerTabs, toolbarGroup);
addDisabledTab(RENDER_TAB_LABEL, runnerTabs, toolbarGroup);
}
}
else {
// Add a message about the inspector not being available in release mode.
final JBLabel label = new JBLabel("Inspector not available in release mode", SwingConstants.CENTER);
label.setForeground(UIUtil.getLabelDisabledForeground());
tabContainer.add(label, BorderLayout.CENTER);
}
}
示例6
private void addInspectorViewContent(FlutterApp app, @Nullable InspectorService inspectorService, ToolWindow toolWindow) {
final ContentManager contentManager = toolWindow.getContentManager();
final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(true);
final JBRunnerTabs runnerTabs = new JBRunnerTabs(myProject, ActionManager.getInstance(), IdeFocusManager.getInstance(myProject), this);
runnerTabs.setSelectionChangeHandler(this::onTabSelectionChange);
final JPanel tabContainer = new JPanel(new BorderLayout());
final String tabName;
final FlutterDevice device = app.device();
if (device == null) {
tabName = app.getProject().getName();
}
else {
final List<FlutterDevice> existingDevices = new ArrayList<>();
for (FlutterApp otherApp : perAppViewState.keySet()) {
existingDevices.add(otherApp.device());
}
tabName = device.getUniqueName(existingDevices);
}
final Content content = contentManager.getFactory().createContent(null, tabName, false);
tabContainer.add(runnerTabs.getComponent(), BorderLayout.CENTER);
content.setComponent(tabContainer);
content.putUserData(ToolWindow.SHOW_CONTENT_ICON, Boolean.TRUE);
content.setIcon(FlutterIcons.Phone);
contentManager.addContent(content);
if (emptyContent != null) {
contentManager.removeContent(emptyContent, true);
emptyContent = null;
}
contentManager.setSelectedContent(content);
final PerAppState state = getOrCreateStateForApp(app);
assert (state.content == null);
state.content = content;
final DefaultActionGroup toolbarGroup = createToolbar(toolWindow, app, inspectorService);
toolWindowPanel.setToolbar(ActionManager.getInstance().createActionToolbar("FlutterViewToolbar", toolbarGroup, true).getComponent());
toolbarGroup.add(new OverflowAction(getOrCreateStateForApp(app), this, app));
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("InspectorToolbar", toolbarGroup, true);
final JComponent toolbarComponent = toolbar.getComponent();
toolbarComponent.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
tabContainer.add(toolbarComponent, BorderLayout.NORTH);
final boolean debugConnectionAvailable = app.getLaunchMode().supportsDebugConnection();
final boolean hasInspectorService = inspectorService != null;
// If the inspector is available (non-release mode), then show it.
if (debugConnectionAvailable) {
if (hasInspectorService) {
final boolean detailsSummaryViewSupported = inspectorService.isDetailsSummaryViewSupported();
addInspectorPanel(WIDGET_TAB_LABEL, runnerTabs, state, InspectorService.FlutterTreeType.widget, app, inspectorService, toolWindow,
toolbarGroup, true, detailsSummaryViewSupported);
addInspectorPanel(RENDER_TAB_LABEL, runnerTabs, state, InspectorService.FlutterTreeType.renderObject, app, inspectorService,
toolWindow, toolbarGroup, false, false);
}
else {
// If in profile mode, add disabled tabs for the inspector.
addDisabledTab(WIDGET_TAB_LABEL, runnerTabs, toolbarGroup);
addDisabledTab(RENDER_TAB_LABEL, runnerTabs, toolbarGroup);
}
}
else {
// Add a message about the inspector not being available in release mode.
final JBLabel label = new JBLabel("Inspector not available in release mode", SwingConstants.CENTER);
label.setForeground(UIUtil.getLabelDisabledForeground());
tabContainer.add(label, BorderLayout.CENTER);
}
}
示例7
public PantsConsoleViewPanel(Project project, ConsoleView console) {
myProject = project;
myConfiguration = ErrorTreeViewConfiguration.getInstance(project);
setLayout(new BorderLayout());
AutoScrollToSourceHandler autoScrollToSourceHandler = new AutoScrollToSourceHandler() {
@Override
protected boolean isAutoScrollMode() {
return myConfiguration.isAutoscrollToSource();
}
@Override
protected void setAutoScrollMode(boolean state) {
myConfiguration.setAutoscrollToSource(state);
}
};
JPanel myMessagePanel = new JPanel(new BorderLayout());
DefaultMutableTreeNode root = new DefaultMutableTreeNode();
final DefaultTreeModel treeModel = new DefaultTreeModel(root);
Tree tree = createTree(treeModel);
tree.getEmptyText().setText(IdeBundle.message("errortree.noMessages"));
autoScrollToSourceHandler.install(tree);
TreeUtil.installActions(tree);
tree.setRootVisible(false);
tree.setShowsRootHandles(true);
tree.setLargeModel(true);
JScrollPane scrollPane = NewErrorTreeRenderer.install(tree);
scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
myMessagePanel.add(console.getComponent(), BorderLayout.CENTER);
add(createToolbarPanel(), BorderLayout.WEST);
add(myMessagePanel, BorderLayout.CENTER);
EditSourceOnDoubleClickHandler.install(tree);
}
示例8
public ServersToolWindowContent(@Nonnull Project project) {
super(new BorderLayout());
myProject = project;
myTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode());
myTree = new Tree(myTreeModel);
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.setCellRenderer(new NodeRenderer());
myTree.setLineStyleAngled();
getMainPanel().add(createToolbar(), BorderLayout.WEST);
Splitter splitter = new OnePixelSplitter(false, 0.3f);
splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree, SideBorder.LEFT));
myPropertiesPanelLayout = new CardLayout();
myPropertiesPanel = new JPanel(myPropertiesPanelLayout);
myMessageLabel = new JLabel(EMPTY_SELECTION_MESSAGE, SwingConstants.CENTER);
myPropertiesPanel.add(MESSAGE_CARD, new Wrapper(myMessageLabel));
splitter.setSecondComponent(myPropertiesPanel);
getMainPanel().add(splitter, BorderLayout.CENTER);
setupBuilder(project);
for (RemoteServersViewContributor contributor : RemoteServersViewContributor.EP_NAME.getExtensionList()) {
contributor.setupTree(myProject, myTree, myBuilder);
}
myTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
onSelectionChanged();
}
});
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent event) {
Set<ServersTreeStructure.RemoteServerNode> nodes = getSelectedRemoteServerNodes();
if (nodes.size() == 1) {
RemoteServer<?> server = nodes.iterator().next().getValue();
ServerConnectionManager.getInstance().getOrCreateConnection(server).computeDeployments(EmptyRunnable.INSTANCE);
return true;
}
return false;
}
}.installOn(myTree);
}
示例9
public NewErrorTreeViewPanel(Project project, String helpId, boolean createExitAction, boolean createToolbar, @Nullable Runnable rerunAction) {
myProject = project;
myHelpId = helpId;
myConfiguration = ErrorTreeViewConfiguration.getInstance(project);
setLayout(new BorderLayout());
myAutoScrollToSourceHandler = new AutoScrollToSourceHandler() {
@Override
protected boolean isAutoScrollMode() {
return myConfiguration.isAutoscrollToSource();
}
@Override
protected void setAutoScrollMode(boolean state) {
myConfiguration.setAutoscrollToSource(state);
}
};
myMessagePanel = new JPanel(new BorderLayout());
myErrorViewStructure = new ErrorViewStructure(project, canHideWarningsOrInfos());
DefaultMutableTreeNode root = new DefaultMutableTreeNode();
root.setUserObject(myErrorViewStructure.createDescriptor(myErrorViewStructure.getRootElement(), null));
final DefaultTreeModel treeModel = new DefaultTreeModel(root);
myTree = new Tree(treeModel) {
@Override
public void setRowHeight(int i) {
super.setRowHeight(0);
// this is needed in order to make UI calculate the height for each particular row
}
};
myBuilder = new ErrorViewTreeBuilder(myTree, treeModel, myErrorViewStructure);
myExporterToTextFile = new ErrorViewTextExporter(myErrorViewStructure);
myOccurenceNavigatorSupport = new MyOccurenceNavigatorSupport(myTree);
myAutoScrollToSourceHandler.install(myTree);
TreeUtil.installActions(myTree);
UIUtil.setLineStyleAngled(myTree);
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.setLargeModel(true);
JScrollPane scrollPane = NewErrorTreeRenderer.install(myTree);
scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
myMessagePanel.add(scrollPane, BorderLayout.CENTER);
if (createToolbar) {
add(createToolbarPanel(rerunAction), BorderLayout.WEST);
}
add(myMessagePanel, BorderLayout.CENTER);
myTree.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
navigateToSource(false);
}
}
});
myTree.addMouseListener(new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
popupInvoked(comp, x, y);
}
});
EditSourceOnDoubleClickHandler.install(myTree);
}