use of com.intellij.ui.components.JBScrollPane in project watchdog by TestRoots.
the class WatchDogView method makeScrollable.
private void makeScrollable() {
JBScrollPane scrollPane = new JBScrollPane(oneColumn);
parent.add(scrollPane);
scrollPane.setViewportView(oneColumn);
scrollPane.getVerticalScrollBar().setUnitIncrement(16);
}
use of com.intellij.ui.components.JBScrollPane in project Perl5-IDEA by Camelcade.
the class Perl5ProjectConfigurable method createComponent.
@Nullable
@Override
public JComponent createComponent() {
FormBuilder builder = FormBuilder.createFormBuilder();
builder.getPanel().setLayout(new VerticalFlowLayout());
builder.addComponent(myPerl5SdkConfigurable.createComponent());
FormBuilder versionBuilder = FormBuilder.createFormBuilder();
ComboBoxModel<PerlVersion> versionModel = new CollectionComboBoxModel<>(PerlVersion.ALL_VERSIONS);
myTargetPerlVersionComboBox = new ComboBox<>(versionModel);
myTargetPerlVersionComboBox.setRenderer(new ColoredListCellRenderer<PerlVersion>() {
@Override
protected void customizeCellRenderer(@NotNull JList<? extends PerlVersion> list, PerlVersion value, int index, boolean selected, boolean hasFocus) {
append(value.getStrictDottedVersion());
String versionDescription = PerlVersion.PERL_VERSION_DESCRIPTIONS.get(value);
if (StringUtil.isNotEmpty(versionDescription)) {
append(" (" + versionDescription + ")");
}
}
});
versionBuilder.addLabeledComponent(PerlBundle.message("perl.config.language.level"), myTargetPerlVersionComboBox);
builder.addComponent(versionBuilder.getPanel());
myLibsModel = new CollectionListModel<>();
myLibsList = new JBList<>(myLibsModel);
myLibsList.setVisibleRowCount(ourRowsCount);
myLibsList.setCellRenderer(new ColoredListCellRenderer<VirtualFile>() {
@Override
protected void customizeCellRenderer(@NotNull JList<? extends VirtualFile> list, VirtualFile value, int index, boolean selected, boolean hasFocus) {
setIcon(PerlIcons.PERL_LANGUAGE_ICON);
append(FileUtil.toSystemDependentName(value.getPath()));
}
});
builder.addLabeledComponent(PerlBundle.message("perl.settings.external.libs"), ToolbarDecorator.createDecorator(myLibsList).setAddAction(this::doAddExternalLibrary).createPanel());
simpleMainCheckbox = new JCheckBox(PerlBundle.message("perl.config.simple.main"));
builder.addComponent(simpleMainCheckbox);
autoInjectionCheckbox = new JCheckBox(PerlBundle.message("perl.config.heredoc.injections"));
builder.addComponent(autoInjectionCheckbox);
allowInjectionWithInterpolation = new JCheckBox(PerlBundle.message("perl.config.heredoc.injections.qq"));
builder.addComponent(allowInjectionWithInterpolation);
allowRegexpInjections = new JCheckBox(PerlBundle.message("perl.config.regex.injections"));
builder.addComponent(allowRegexpInjections);
allowRegexpInjections.setEnabled(false);
allowRegexpInjections.setVisible(false);
perlAnnotatorCheckBox = new JCheckBox(PerlBundle.message("perl.config.annotations.cw"));
// builder.addComponent(perlAnnotatorCheckBox);
perlCriticCheckBox = new JCheckBox(PerlBundle.message("perl.config.annotations.critic"));
builder.addComponent(perlCriticCheckBox);
enablePerlSwitchCheckbox = new JCheckBox(PerlBundle.message("perl.config.enable.switch"));
builder.addComponent(enablePerlSwitchCheckbox);
perlCriticPathInputField = new TextFieldWithBrowseButton();
perlCriticPathInputField.setEditable(false);
FileChooserDescriptor perlCriticDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || StringUtil.equals(file.getNameWithoutExtension(), PerlCriticAnnotator.PERL_CRITIC_LINUX_NAME));
}
};
// noinspection DialogTitleCapitalization
perlCriticPathInputField.addBrowseFolderListener(PerlBundle.message("perl.config.select.file.title"), PerlBundle.message("perl.config.select.critic"), // project
null, perlCriticDescriptor);
builder.addLabeledComponent(new JLabel(PerlBundle.message("perl.config.path.critic")), perlCriticPathInputField);
perlCriticArgsInputField = new RawCommandLineEditor();
builder.addComponent(copyDialogCaption(LabeledComponent.create(perlCriticArgsInputField, PerlBundle.message("perl.config.critic.cmd.arguments")), PerlBundle.message("perl.config.critic.cmd.arguments")));
perlTidyPathInputField = new TextFieldWithBrowseButton();
perlTidyPathInputField.setEditable(false);
FileChooserDescriptor perlTidyDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || StringUtil.equals(file.getNameWithoutExtension(), PerlFormatWithPerlTidyAction.PERL_TIDY_LINUX_NAME));
}
};
// noinspection DialogTitleCapitalization
perlTidyPathInputField.addBrowseFolderListener(PerlBundle.message("perl.config.select.file.title"), PerlBundle.message("perl.config.select.tidy"), // project
null, perlTidyDescriptor);
builder.addLabeledComponent(new JLabel(PerlBundle.message("perl.config.path.tidy")), perlTidyPathInputField);
perlTidyArgsInputField = new RawCommandLineEditor();
builder.addComponent(copyDialogCaption(LabeledComponent.create(perlTidyArgsInputField, PerlBundle.message("perl.config.tidy.options.label")), PerlBundle.message("perl.config.tidy.options.label.short")));
deparseArgumentsTextField = new JTextField();
builder.addLabeledComponent(PerlBundle.message("perl.config.deparse.options.label"), deparseArgumentsTextField);
selfNamesModel = new CollectionListModel<>();
JBList selfNamesList = new JBList<>(selfNamesModel);
selfNamesList.setVisibleRowCount(ourRowsCount);
builder.addLabeledComponent(new JLabel(PerlBundle.message("perl.config.self.names.label")), ToolbarDecorator.createDecorator(selfNamesList).setAddAction(anActionButton -> {
String variableName = Messages.showInputDialog(myProject, PerlBundle.message("perl.config.self.add.text"), PerlBundle.message("perl.config.self.add.title"), Messages.getQuestionIcon(), "", null);
if (StringUtil.isNotEmpty(variableName)) {
while (variableName.startsWith("$")) {
variableName = variableName.substring(1);
}
if (StringUtil.isNotEmpty(variableName) && !selfNamesModel.getItems().contains(variableName)) {
selfNamesModel.add(variableName);
}
}
}).createPanel());
JBScrollPane scrollPane = new JBScrollPane(builder.getPanel(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(new JBEmptyBorder(JBUI.emptyInsets()));
return scrollPane;
}
use of com.intellij.ui.components.JBScrollPane in project netbeans-mmd-plugin by raydac.
the class KeyShortCutEditPanel method initComponents.
@SuppressWarnings("unchecked")
private void initComponents() {
scrollPaneTable = new JBScrollPane();
tableKeyShortcuts = new JBTable();
mainPanel = new JBPanel();
labelKeyCode = new JBLabel();
checkBoxALT = new JBCheckBox();
checkBoxCTRL = new JBCheckBox();
checkBoxSHIFT = new JBCheckBox();
checkBoxMeta = new JBCheckBox();
textFieldKeyCode = new JBTextField();
buttonEditKeyCode = new JToggleButton();
setLayout(new java.awt.BorderLayout());
// NOI18N
scrollPaneTable.setBorder(javax.swing.BorderFactory.createTitledBorder(BUNDLE.getString("KeyShortCutEditPanel.ScrollPaneBorderTitle")));
tableKeyShortcuts.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
tableKeyShortcuts.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tableKeyShortcutsMouseClicked(evt);
}
});
scrollPaneTable.setViewportView(tableKeyShortcuts);
add(scrollPaneTable, java.awt.BorderLayout.CENTER);
// NOI18N
labelKeyCode.setText(BUNDLE.getString("KeyShortCutEditPanel.labelKeyCode.text"));
// NOI18N
checkBoxALT.setText(BUNDLE.getString("KeyShortCutEditPanel.checkBoxALT.text"));
// NOI18N
checkBoxCTRL.setText(BUNDLE.getString("KeyShortCutEditPanel.checkBoxCTRL.text"));
// NOI18N
checkBoxSHIFT.setText(BUNDLE.getString("KeyShortCutEditPanel.checkBoxSHIFT.text"));
// NOI18N
checkBoxMeta.setText(BUNDLE.getString("KeyShortCutEditPanel.checkBoxMeta.text"));
textFieldKeyCode.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
textFieldKeyCodeFocusLost(evt);
}
});
textFieldKeyCode.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
textFieldKeyCodeKeyTyped(evt);
}
public void keyPressed(java.awt.event.KeyEvent evt) {
textFieldKeyCodeKeyPressed(evt);
}
});
// NOI18N
buttonEditKeyCode.setText(BUNDLE.getString("KeyShortCutEditPanel.buttonEditKeyCode.text"));
buttonEditKeyCode.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEditKeyCodeActionPerformed(evt);
}
});
javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup().addContainerGap(44, Short.MAX_VALUE).addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addGroup(mainPanelLayout.createSequentialGroup().addComponent(labelKeyCode).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(textFieldKeyCode)).addGroup(mainPanelLayout.createSequentialGroup().addComponent(checkBoxALT).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(checkBoxCTRL).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(checkBoxSHIFT).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(checkBoxMeta))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(buttonEditKeyCode).addContainerGap()));
mainPanelLayout.setVerticalGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addContainerGap().addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(buttonEditKeyCode, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE).addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(labelKeyCode).addComponent(textFieldKeyCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(checkBoxALT).addComponent(checkBoxCTRL).addComponent(checkBoxSHIFT).addComponent(checkBoxMeta)))).addContainerGap(44, Short.MAX_VALUE)));
add(mainPanel, java.awt.BorderLayout.PAGE_END);
}
use of com.intellij.ui.components.JBScrollPane in project netbeans-mmd-plugin by raydac.
the class MindMapTreePanel method initComponents.
@SuppressWarnings("unchecked")
private void initComponents() {
treeScrollPane = new JBScrollPane();
treeMindMap = new Tree();
toolBar = new javax.swing.JToolBar();
buttonExpandAll = new javax.swing.JButton();
buttonCollapseAll = new javax.swing.JButton();
buttonUnselect = new javax.swing.JButton();
setLayout(new java.awt.BorderLayout());
treeScrollPane.setViewportView(treeMindMap);
add(treeScrollPane, java.awt.BorderLayout.CENTER);
toolBar.setFloatable(false);
toolBar.setRollover(true);
buttonExpandAll.setIcon(AllIcons.Buttons.EXPANDALL);
java.util.ResourceBundle bundle = BUNDLE;
// NOI18N
buttonExpandAll.setText(bundle.getString("MindMapTreePanel.buttonExpandAll.text"));
buttonExpandAll.setFocusable(false);
buttonExpandAll.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonExpandAll.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
buttonExpandAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonExpandAllActionPerformed(evt);
}
});
toolBar.add(buttonExpandAll);
buttonCollapseAll.setIcon(AllIcons.Buttons.COLLAPSEALL);
// NOI18N
buttonCollapseAll.setText(bundle.getString("MindMapTreePanel.buttonCollapseAll.text"));
buttonCollapseAll.setFocusable(false);
buttonCollapseAll.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonCollapseAll.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
buttonCollapseAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonCollapseAllActionPerformed(evt);
}
});
toolBar.add(buttonCollapseAll);
buttonUnselect.setIcon(AllIcons.Buttons.SELECT);
// NOI18N
buttonUnselect.setText(bundle.getString("MindMapTreePanel.buttonUnselect.text"));
buttonUnselect.setFocusable(false);
buttonUnselect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
buttonUnselect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
buttonUnselect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonUnselectActionPerformed(evt);
}
});
toolBar.add(buttonUnselect);
add(toolBar, java.awt.BorderLayout.PAGE_START);
}
use of com.intellij.ui.components.JBScrollPane in project azure-tools-for-java by Microsoft.
the class SparkSubmissionToolWindowProcessor method initialize.
public void initialize() {
ApplicationManager.getApplication().assertIsDispatchThread();
// TODO: Fix deprecated API "addUISettingsListener"
UISettings.getInstance().addUISettingsListener(new UISettingsListener() {
@Override
public void uiSettingsChanged(final UISettings uiSettings) {
synchronized (this) {
for (final IHtmlElement htmlElement : cachedInfo) {
htmlElement.changeTheme();
}
setToolWindowText(parserHtmlElementList(cachedInfo));
}
}
}, ApplicationManager.getApplication());
fontFace = jEditorPanel.getFont().getFamily();
final JPanel jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
jEditorPanel.setMargin(JBUI.insetsLeft(10));
final JBScrollPane scrollPane = new JBScrollPane(jEditorPanel);
stopButton = new JButton(PluginUtil.getIcon(CommonConst.StopIconPath));
stopButton.setDisabledIcon(PluginUtil.getIcon(CommonConst.StopDisableIconPath));
stopButton.setEnabled(false);
stopButton.setToolTipText("stop execution of current application");
stopButton.addActionListener(e -> DefaultLoader.getIdeHelper().executeOnPooledThread(() -> {
if (clusterDetail != null) {
AppInsightsClient.create(HDInsightBundle.message("SparkSubmissionStopButtionClickEvent"), null);
EventUtil.logEvent(EventType.info, HDINSIGHT, HDInsightBundle.message("SparkSubmissionStopButtionClickEvent"), null);
try {
final String livyUrl = clusterDetail instanceof LivyCluster ? ((LivyCluster) clusterDetail).getLivyBatchUrl() : null;
final HttpResponse deleteResponse = SparkBatchSubmission.getInstance().killBatchJob(livyUrl, batchId);
if (deleteResponse.getCode() == 201 || deleteResponse.getCode() == 200) {
jobStatusManager.setJobKilled();
setInfo("========================Stop application successfully" + "=======================");
} else {
setError(String.format("Error : Failed to stop spark application. error code : %d, reason : %s.", deleteResponse.getCode(), deleteResponse.getContent()));
}
} catch (final IOException exception) {
setError("Error : Failed to stop spark application. exception : " + exception.toString());
}
}
}));
openSparkUIButton = new JButton(PluginUtil.getIcon(IconPathBuilder.custom(CommonConst.OpenSparkUIIconName).build()));
openSparkUIButton.setDisabledIcon(PluginUtil.getIcon(CommonConst.OpenSparkUIDisableIconPath));
openSparkUIButton.setEnabled(false);
openSparkUIButton.setToolTipText("open the corresponding Spark UI page");
openSparkUIButton.addActionListener(e -> {
if (Desktop.isDesktopSupported()) {
try {
if (jobStatusManager.isApplicationGenerated()) {
final String connectionURL = clusterDetail.getConnectionUrl();
final String sparkApplicationUrl = clusterDetail.isEmulator() ? String.format(yarnRunningUIEmulatorUrlFormat, ((EmulatorClusterDetail) clusterDetail).getSparkHistoryEndpoint(), jobStatusManager.getApplicationId()) : String.format(yarnRunningUIUrlFormat, connectionURL, jobStatusManager.getApplicationId());
Desktop.getDesktop().browse(new URI(sparkApplicationUrl));
}
} catch (final Exception browseException) {
DefaultLoader.getUIHelper().showError("Failed to browse spark application yarn url", "Spark Submission");
}
}
});
final JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
buttonPanel.add(stopButton);
buttonPanel.add(openSparkUIButton);
final GridBagConstraints c00 = new GridBagConstraints();
c00.fill = GridBagConstraints.VERTICAL;
c00.weighty = 1;
c00.gridx = 0;
c00.gridy = 0;
jPanel.add(buttonPanel, c00);
final GridBagConstraints c10 = new GridBagConstraints();
c10.fill = GridBagConstraints.BOTH;
c10.weightx = 1;
c10.weighty = 1;
c10.gridx = 1;
c10.gridy = 0;
jPanel.add(scrollPane, c10);
toolWindow.getComponent().add(jPanel);
jEditorPanel.setEditable(false);
jEditorPanel.setOpaque(false);
jEditorPanel.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
jEditorPanel.addHyperlinkListener(e -> {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (Desktop.isDesktopSupported()) {
try {
final String protocol = e.getURL().getProtocol();
if ("https".equals(protocol) || "http".equals(protocol)) {
Desktop.getDesktop().browse(e.getURL().toURI());
} else if ("file".equals(protocol)) {
final String path = e.getURL().getFile();
final File localFile = new File(path);
final File parentFile = localFile.getParentFile();
if (parentFile.exists() && parentFile.isDirectory()) {
Desktop.getDesktop().open(parentFile);
}
}
} catch (final Exception exception) {
DefaultLoader.getUIHelper().showError(exception.getMessage(), "Open Local Folder Error");
}
}
}
});
final PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent evt) {
if (ApplicationManager.getApplication().isDispatchThread()) {
changeSupportHandler(evt);
} else {
try {
SwingUtilities.invokeAndWait(() -> changeSupportHandler(evt));
} catch (final InterruptedException ignore) {
} catch (final InvocationTargetException e) {
e.printStackTrace();
}
}
}
private void changeSupportHandler(final PropertyChangeEvent evt) {
if ("toolWindowText".equals(evt.getPropertyName())) {
jEditorPanel.setText(evt.getNewValue().toString());
} else if ("isStopButtonEnable".equals(evt.getPropertyName())) {
stopButton.setEnabled(Boolean.parseBoolean(evt.getNewValue().toString()));
} else if ("isBrowserButtonEnable".equals(evt.getPropertyName())) {
openSparkUIButton.setEnabled(Boolean.parseBoolean(evt.getNewValue().toString()));
}
}
};
jEditorPanel.addPropertyChangeListener(propertyChangeListener);
changeSupport = new PropertyChangeSupport(jEditorPanel);
changeSupport.addPropertyChangeListener(propertyChangeListener);
}
Aggregations