use of javax.swing.event.ChangeEvent in project intellij-community by JetBrains.
the class AppearanceConfigurable method createComponent.
@SuppressWarnings("unchecked")
@Override
public JComponent createComponent() {
UISettings settings = UISettings.getInstance();
initComponent();
myComponent.myFontSizeCombo.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
myComponent.myPresentationModeFontSize.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
myComponent.myFontSizeCombo.setEditable(true);
myComponent.myPresentationModeFontSize.setEditable(true);
myComponent.myLafComboBox.setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels()));
myComponent.myLafComboBox.setRenderer(new LafComboBoxRenderer());
myComponent.myAntialiasingInIDE.setModel(new DefaultComboBoxModel(AntialiasingType.values()));
myComponent.myAntialiasingInEditor.setModel(new DefaultComboBoxModel(AntialiasingType.values()));
myComponent.myAntialiasingInIDE.setSelectedItem(settings.getIdeAAType());
myComponent.myAntialiasingInEditor.setSelectedItem(settings.getEditorAAType());
myComponent.myAntialiasingInIDE.setRenderer(new AAListCellRenderer(false));
myComponent.myAntialiasingInEditor.setRenderer(new AAListCellRenderer(true));
@SuppressWarnings("UseOfObsoleteCollectionType") Dictionary<Integer, JComponent> delayDictionary = new Hashtable<>();
delayDictionary.put(new Integer(0), new JLabel("0"));
delayDictionary.put(new Integer(1200), new JLabel("1200"));
//delayDictionary.put(new Integer(2400), new JLabel("2400"));
myComponent.myInitialTooltipDelaySlider.setLabelTable(delayDictionary);
UIUtil.setSliderIsFilled(myComponent.myInitialTooltipDelaySlider, Boolean.TRUE);
myComponent.myInitialTooltipDelaySlider.setMinimum(0);
myComponent.myInitialTooltipDelaySlider.setMaximum(1200);
myComponent.myInitialTooltipDelaySlider.setPaintLabels(true);
myComponent.myInitialTooltipDelaySlider.setPaintTicks(true);
myComponent.myInitialTooltipDelaySlider.setPaintTrack(true);
myComponent.myInitialTooltipDelaySlider.setMajorTickSpacing(1200);
myComponent.myInitialTooltipDelaySlider.setMinorTickSpacing(100);
myComponent.myEnableAlphaModeCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean state = myComponent.myEnableAlphaModeCheckBox.isSelected();
myComponent.myAlphaModeDelayTextField.setEnabled(state);
myComponent.myAlphaModeRatioSlider.setEnabled(state);
}
});
myComponent.myAlphaModeRatioSlider.setSize(100, 50);
@SuppressWarnings({ "UseOfObsoleteCollectionType" }) Dictionary<Integer, JComponent> dictionary = new Hashtable<>();
dictionary.put(new Integer(0), new JLabel("0%"));
dictionary.put(new Integer(50), new JLabel("50%"));
dictionary.put(new Integer(100), new JLabel("100%"));
myComponent.myAlphaModeRatioSlider.setLabelTable(dictionary);
UIUtil.setSliderIsFilled(myComponent.myAlphaModeRatioSlider, Boolean.TRUE);
myComponent.myAlphaModeRatioSlider.setPaintLabels(true);
myComponent.myAlphaModeRatioSlider.setPaintTicks(true);
myComponent.myAlphaModeRatioSlider.setPaintTrack(true);
myComponent.myAlphaModeRatioSlider.setMajorTickSpacing(50);
myComponent.myAlphaModeRatioSlider.setMinorTickSpacing(10);
myComponent.myAlphaModeRatioSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
myComponent.myAlphaModeRatioSlider.setToolTipText(myComponent.myAlphaModeRatioSlider.getValue() + "%");
}
});
myComponent.myTransparencyPanel.setVisible(WindowManagerEx.getInstanceEx().isAlphaModeSupported());
return myComponent.myPanel;
}
use of javax.swing.event.ChangeEvent in project intellij-community by JetBrains.
the class UnnecessaryFinalOnLocalVariableOrParameterInspection method createOptionsPanel.
@Override
@Nullable
public JComponent createOptionsPanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final JCheckBox abstractOnlyCheckBox = new JCheckBox(InspectionGadgetsBundle.message("unnecessary.final.on.parameter.only.interface.option"), onlyWarnOnAbstractMethods) {
@Override
public void setEnabled(boolean b) {
// inspection settings (otherwise it is always enabled)
if (b) {
super.setEnabled(reportParameters);
} else {
super.setEnabled(false);
}
}
};
abstractOnlyCheckBox.setEnabled(true);
abstractOnlyCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
onlyWarnOnAbstractMethods = abstractOnlyCheckBox.isSelected();
}
});
final JCheckBox reportLocalVariablesCheckBox = new JCheckBox(InspectionGadgetsBundle.message("unnecessary.final.report.local.variables.option"), reportLocalVariables);
final JCheckBox reportParametersCheckBox = new JCheckBox(InspectionGadgetsBundle.message("unnecessary.final.report.parameters.option"), reportParameters);
reportLocalVariablesCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
reportLocalVariables = reportLocalVariablesCheckBox.isSelected();
if (!reportLocalVariables) {
reportParametersCheckBox.setSelected(true);
}
}
});
reportParametersCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
reportParameters = reportParametersCheckBox.isSelected();
if (!reportParameters) {
reportLocalVariablesCheckBox.setSelected(true);
}
abstractOnlyCheckBox.setEnabled(reportParameters);
}
});
final GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.weightx = 1.0;
panel.add(reportLocalVariablesCheckBox, constraints);
constraints.gridy = 1;
panel.add(reportParametersCheckBox, constraints);
constraints.insets.left = 20;
constraints.gridy = 2;
constraints.weighty = 1.0;
panel.add(abstractOnlyCheckBox, constraints);
return panel;
}
use of javax.swing.event.ChangeEvent in project intellij-community by JetBrains.
the class IdeErrorsDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
DefaultActionGroup goBack = new DefaultActionGroup();
BackAction back = new BackAction();
goBack.add(back);
ActionToolbar backToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, goBack, true);
backToolbar.getComponent().setBorder(IdeBorderFactory.createEmptyBorder());
backToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
myBackButtonPanel.add(backToolbar.getComponent(), BorderLayout.CENTER);
DefaultActionGroup goForward = new DefaultActionGroup();
ForwardAction forward = new ForwardAction();
goForward.add(forward);
ActionToolbar forwardToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, goForward, true);
forwardToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
forwardToolbar.getComponent().setBorder(IdeBorderFactory.createEmptyBorder());
myNextButtonPanel.add(forwardToolbar.getComponent(), BorderLayout.CENTER);
myTabs = new HeaderlessTabbedPane(getDisposable());
final LabeledTextComponent.TextListener commentsListener = new LabeledTextComponent.TextListener() {
@Override
public void textChanged(String newText) {
if (myMute) {
return;
}
AbstractMessage message = getSelectedMessage();
if (message != null) {
message.setAdditionalInfo(newText);
}
}
};
if (!myInternalMode) {
myDetailsTabForm = new DetailsTabForm(null, false);
myCommentsTabForm = new CommentsTabForm();
myCommentsTabForm.addCommentsListener(commentsListener);
myTabs.addTab(DiagnosticBundle.message("error.comments.tab.title"), myCommentsTabForm.getContentPane());
myDetailsTabForm.setCommentsAreaVisible(false);
} else {
final AnAction analyzePlatformAction = ActionManager.getInstance().getAction("AnalyzeStacktraceOnError");
if (analyzePlatformAction != null) {
myAnalyzeAction = new AnalyzeAction(analyzePlatformAction);
}
myDetailsTabForm = new DetailsTabForm(myAnalyzeAction, true);
myDetailsTabForm.setCommentsAreaVisible(true);
myDetailsTabForm.addCommentsListener(commentsListener);
}
myTabs.addTab(DiagnosticBundle.message("error.details.tab.title"), myDetailsTabForm.getContentPane());
myAttachmentsTabForm = new AttachmentsTabForm();
myAttachmentsTabForm.addInclusionListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
updateAttachmentWarning(getSelectedMessage());
}
});
int activeTabIndex = Integer.parseInt(PropertiesComponent.getInstance().getValue(ACTIVE_TAB_OPTION, "0"));
if (activeTabIndex >= myTabs.getTabCount() || activeTabIndex < 0) {
// may happen if myInternalMode changed since last open
activeTabIndex = 0;
}
myTabs.setSelectedIndex(activeTabIndex);
myTabs.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
final JComponent c = getPreferredFocusedComponent();
if (c != null) {
IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(c, true);
}
}
});
myTabsPanel.add(myTabs, BorderLayout.CENTER);
myDisableLink.setHyperlinkText(UIUtil.removeMnemonic(DiagnosticBundle.message("error.list.disable.plugin")));
myDisableLink.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
disablePlugin();
}
}
});
myCredentialsLabel.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
JetBrainsAccountDialogKt.showJetBrainsAccountDialog(getRootPane()).show();
updateCredentialsPane(getSelectedMessage());
}
}
});
myAttachmentWarningLabel.setIcon(UIUtil.getBalloonWarningIcon());
myAttachmentWarningLabel.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(final HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
myTabs.setSelectedIndex(myTabs.indexOfComponent(myAttachmentsTabForm.getContentPane()));
myAttachmentsTabForm.selectFirstIncludedAttachment();
}
}
});
myDetailsTabForm.addAssigneeListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (myMute)
return;
AbstractMessage message = getSelectedMessage();
if (message != null) {
message.setAssigneeId(myDetailsTabForm.getAssigneeId());
}
}
});
return myContentPane;
}
use of javax.swing.event.ChangeEvent in project intellij-plugins by JetBrains.
the class AirPackageDialog method createUIComponents.
private void createUIComponents() {
myTree = new FlexBCTree(myProject, bc -> {
final BuildConfigurationNature nature = bc.getNature();
return nature.isApp() && !nature.isWebPlatform();
});
myTree.addToggleCheckBoxListener(new ChangeListener() {
public void stateChanged(final ChangeEvent e) {
updateControlsEnabledState();
}
});
}
use of javax.swing.event.ChangeEvent in project intellij-community by JetBrains.
the class GitShelveUtils method shelveChanges.
/**
* Shelve changes
*
*
* @param project the context project
* @param shelveManager the shelve manager
* @param changes the changes to process
* @param description the description of for the shelve
* @param exceptions the generated exceptions
* @param rollback
* @return created shelved change list or null in case failure
*/
@Nullable
public static ShelvedChangeList shelveChanges(final Project project, final ShelveChangesManager shelveManager, Collection<Change> changes, final String description, final List<VcsException> exceptions, boolean rollback, boolean markToBeDeleted) {
try {
ShelvedChangeList shelve = shelveManager.shelveChanges(changes, description, rollback, markToBeDeleted);
project.getMessageBus().syncPublisher(ShelveChangesManager.SHELF_TOPIC).stateChanged(new ChangeEvent(GitStashUtils.class));
return shelve;
} catch (IOException e) {
//noinspection ThrowableInstanceNeverThrown
exceptions.add(new VcsException("Shelving changes failed: " + description, e));
return null;
} catch (VcsException e) {
exceptions.add(e);
return null;
}
}
Aggregations