Search in sources :

Example 46 with ChangeEvent

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;
}
Also used : Hashtable(java.util.Hashtable) ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener)

Example 47 with ChangeEvent

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;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) Nullable(org.jetbrains.annotations.Nullable)

Example 48 with ChangeEvent

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;
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) ActionEvent(java.awt.event.ActionEvent) HeaderlessTabbedPane(com.intellij.ui.HeaderlessTabbedPane) ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) HyperlinkListener(javax.swing.event.HyperlinkListener) ChangeListener(javax.swing.event.ChangeListener)

Example 49 with ChangeEvent

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();
        }
    });
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) ActionListener(java.awt.event.ActionListener) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) DialogWrapper(com.intellij.openapi.ui.DialogWrapper) Project(com.intellij.openapi.project.Project) Messages(com.intellij.openapi.ui.Messages) ChangeListener(javax.swing.event.ChangeListener) Module(com.intellij.openapi.module.Module) ProjectStructureProblemType(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemType) ValidationInfo(com.intellij.openapi.ui.ValidationInfo) ChangeEvent(javax.swing.event.ChangeEvent) StringUtil(com.intellij.openapi.util.text.StringUtil) Collection(java.util.Collection) FlexBCTree(com.intellij.lang.javascript.flex.actions.FlexBCTree) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) ValidateFlashConfigurationsPrecompileTask(com.intellij.lang.javascript.flex.build.ValidateFlashConfigurationsPrecompileTask) ActionEvent(java.awt.event.ActionEvent) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlashProjectStructureProblem(com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem) AirPackageProjectParameters(com.intellij.lang.javascript.flex.actions.airpackage.AirPackageProjectParameters) AirPackagingOptions(com.intellij.lang.javascript.flex.projectStructure.model.AirPackagingOptions) Pair(com.intellij.openapi.util.Pair) Ref(com.intellij.openapi.util.Ref) Consumer(com.intellij.util.Consumer) Condition(com.intellij.openapi.util.Condition) javax.swing(javax.swing) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ChangeEvent(javax.swing.event.ChangeEvent) FlexBCTree(com.intellij.lang.javascript.flex.actions.FlexBCTree) ChangeListener(javax.swing.event.ChangeListener)

Example 50 with ChangeEvent

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;
    }
}
Also used : ShelvedChangeList(com.intellij.openapi.vcs.changes.shelf.ShelvedChangeList) ChangeEvent(javax.swing.event.ChangeEvent) VcsException(com.intellij.openapi.vcs.VcsException) IOException(java.io.IOException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ChangeEvent (javax.swing.event.ChangeEvent)245 ChangeListener (javax.swing.event.ChangeListener)206 JPanel (javax.swing.JPanel)60 ActionEvent (java.awt.event.ActionEvent)52 ActionListener (java.awt.event.ActionListener)47 JLabel (javax.swing.JLabel)40 Dimension (java.awt.Dimension)30 GridBagConstraints (java.awt.GridBagConstraints)27 GridBagLayout (java.awt.GridBagLayout)24 JCheckBox (javax.swing.JCheckBox)24 Insets (java.awt.Insets)22 JButton (javax.swing.JButton)21 JSlider (javax.swing.JSlider)21 PropertyChangeEvent (java.beans.PropertyChangeEvent)20 JSpinner (javax.swing.JSpinner)19 SpinnerNumberModel (javax.swing.SpinnerNumberModel)19 BorderLayout (java.awt.BorderLayout)18 PropertyChangeListener (java.beans.PropertyChangeListener)17 IOException (java.io.IOException)16 BoxLayout (javax.swing.BoxLayout)16