use of com.intellij.openapi.options.ex.Settings in project intellij-community by JetBrains.
the class ScopeColorsPageFactory method createChooseScopePanel.
private static JPanel createChooseScopePanel() {
Project[] projects = ProjectManager.getInstance().getOpenProjects();
JPanel panel = new JPanel(new GridBagLayout());
//panel.setBorder(new LineBorder(Color.red));
if (projects.length == 0)
return panel;
GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.emptyInsets(), 0, 0);
JButton button = new JButton("Manage Scopes...");
button.setPreferredSize(new Dimension(230, button.getPreferredSize().height));
panel.add(button, gc);
gc.gridx = GridBagConstraints.REMAINDER;
gc.weightx = 1;
panel.add(new JPanel(), gc);
gc.gridy++;
gc.gridx = 0;
gc.weighty = 1;
panel.add(new JPanel(), gc);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(@NotNull ActionEvent e) {
DataContext context = DataManager.getInstance().getDataContext(panel);
Settings settings = Settings.KEY.getData(context);
Project project = CommonDataKeys.PROJECT.getData(context);
if (settings != null) {
try {
if (settings.select(settings.find(ScopeChooserConfigurable.PROJECT_SCOPES)).isRejected()) {
EditScopesDialog.showDialog(project, null);
}
} catch (IllegalStateException ex) {
EditScopesDialog.showDialog(project, null);
}
}
}
});
return panel;
}
use of com.intellij.openapi.options.ex.Settings in project intellij-community by JetBrains.
the class LongLineInspection method createOptionsPanel.
@Nullable
@Override
public JComponent createOptionsPanel() {
final HyperlinkLabel codeStyleHyperlink = new HyperlinkLabel("Edit Code Style settings");
codeStyleHyperlink.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
DataManager.getInstance().getDataContextFromFocus().doWhenDone(new Consumer<DataContext>() {
@Override
public void consume(DataContext context) {
if (context != null) {
final Settings settings = Settings.KEY.getData(context);
if (settings != null) {
settings.select(settings.find(CodeStyleSchemesConfigurable.class));
} else {
ShowSettingsUtil.getInstance().showSettingsDialog(CommonDataKeys.PROJECT.getData(context), CodeStyleSchemesConfigurable.class);
}
}
}
});
}
});
final JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(codeStyleHyperlink, BorderLayout.NORTH);
return panel;
}
use of com.intellij.openapi.options.ex.Settings in project android by JetBrains.
the class SdkUpdaterConfigurable method isModified.
@Override
public boolean isModified() {
if (myPanel.isModified()) {
return true;
}
// If the user modifies the channel, comes back here, and then applies the change, we want to be able to update
// right away. Thus we mark ourselves as modified if UpdateSettingsConfigurable is modified, and then reload in
// apply().
DataContext dataContext = DataManager.getInstance().getDataContext(myPanel.getComponent());
Settings data = Settings.KEY.getData(dataContext);
if (data != null) {
Configurable updatesConfigurable = data.find("preferences.updates");
if (updatesConfigurable != null) {
return updatesConfigurable.isModified();
}
}
return false;
}
use of com.intellij.openapi.options.ex.Settings in project intellij-elixir by KronicDeth.
the class ElixirCompilerOptionsConfigurable method setupUiListeners.
private void setupUiListeners() {
myConfigureMixButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DataContext context = DataManager.getInstance().getDataContext(myConfigureMixButton);
Settings settings = ObjectUtils.assertNotNull(Settings.KEY.getData(context));
Configurable configurable = settings.find(ElixirExternalToolsConfigurable.ELIXIR_RELATED_TOOLS);
if (configurable != null) {
settings.select(configurable);
}
}
});
myRootPanel.addAncestorListener(new AncestorAdapter() {
@Override
public void ancestorAdded(AncestorEvent event) {
reset();
}
});
}
use of com.intellij.openapi.options.ex.Settings in project intellij-community by JetBrains.
the class SingleInspectionProfilePanel method createInspectionProfileSettingsPanel.
private JPanel createInspectionProfileSettingsPanel() {
myBrowser = new JEditorPane(UIUtil.HTML_MIME, EMPTY_HTML);
myBrowser.setEditable(false);
myBrowser.setBorder(IdeBorderFactory.createEmptyBorder(5, 5, 5, 5));
myBrowser.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
String description = e.getDescription();
if (description.startsWith(SETTINGS)) {
String configId = description.substring(SETTINGS.length());
DataContext context = DataManager.getInstance().getDataContextFromFocus().getResult();
if (context != null) {
Settings settings = Settings.KEY.getData(context);
if (settings != null) {
settings.select(settings.find(configId));
}
}
} else {
BrowserUtil.browse(description);
}
}
});
initToolStates();
fillTreeData(myProfileFilter != null ? myProfileFilter.getFilter() : null, true);
JPanel descriptionPanel = new JPanel(new BorderLayout());
descriptionPanel.setBorder(IdeBorderFactory.createTitledBorder(InspectionsBundle.message("inspection.description.title"), false, new JBInsets(2, 2, 0, 0)));
descriptionPanel.add(ScrollPaneFactory.createScrollPane(myBrowser), BorderLayout.CENTER);
JBSplitter rightSplitter = new JBSplitter(true, "SingleInspectionProfilePanel.HORIZONTAL_DIVIDER_PROPORTION", DIVIDER_PROPORTION_DEFAULT);
rightSplitter.setFirstComponent(descriptionPanel);
myOptionsPanel = new JPanel(new GridBagLayout());
initOptionsAndDescriptionPanel();
rightSplitter.setSecondComponent(myOptionsPanel);
rightSplitter.setHonorComponentsMinimumSize(true);
final JScrollPane tree = initTreeScrollPane();
final JPanel northPanel = new JPanel(new GridBagLayout());
northPanel.setBorder(IdeBorderFactory.createEmptyBorder(2, 0, 2, 0));
myProfileFilter.setPreferredSize(new Dimension(20, myProfileFilter.getPreferredSize().height));
northPanel.add(myProfileFilter, new GridBagConstraints(0, 0, 1, 1, 0.5, 1, GridBagConstraints.BASELINE_TRAILING, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
northPanel.add(createTreeToolbarPanel().getComponent(), new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
JBSplitter mainSplitter = new OnePixelSplitter(false, DIVIDER_PROPORTION_DEFAULT, 0.01f, 0.99f);
mainSplitter.setSplitterProportionKey("SingleInspectionProfilePanel.VERTICAL_DIVIDER_PROPORTION");
mainSplitter.setFirstComponent(tree);
mainSplitter.setSecondComponent(rightSplitter);
mainSplitter.setHonorComponentsMinimumSize(false);
final JPanel inspectionTreePanel = new JPanel(new BorderLayout());
inspectionTreePanel.add(northPanel, BorderLayout.NORTH);
inspectionTreePanel.add(mainSplitter, BorderLayout.CENTER);
JPanel panel = new JPanel(new BorderLayout());
panel.add(inspectionTreePanel, BorderLayout.CENTER);
final JBCheckBox disableNewInspectionsCheckBox = new JBCheckBox("Disable new inspections by default", getProfile().isProfileLocked());
panel.add(disableNewInspectionsCheckBox, BorderLayout.SOUTH);
disableNewInspectionsCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
final boolean enabled = disableNewInspectionsCheckBox.isSelected();
final InspectionProfileImpl profile = getProfile();
if (profile != null) {
profile.lockProfile(enabled);
}
}
});
return panel;
}
Aggregations