use of com.intellij.ide.util.scopeChooser.ScopeChooserCombo in project intellij-community by JetBrains.
the class AbstractFindUsagesDialog method createSearchScopePanel.
@Nullable
private JComponent createSearchScopePanel() {
if (isInFileOnly())
return null;
JPanel optionsPanel = new JPanel(new BorderLayout());
String scope = myFindUsagesOptions.searchScope.getDisplayName();
myScopeCombo = new ScopeChooserCombo(myProject, mySearchInLibrariesAvailable, true, scope);
Disposer.register(myDisposable, myScopeCombo);
optionsPanel.add(myScopeCombo, BorderLayout.CENTER);
JComponent separator = SeparatorFactory.createSeparator(FindBundle.message("find.scope.label"), myScopeCombo.getComboBox());
optionsPanel.add(separator, BorderLayout.NORTH);
return optionsPanel;
}
use of com.intellij.ide.util.scopeChooser.ScopeChooserCombo in project intellij-community by JetBrains.
the class ScopeBasedTodosPanel method createCenterComponent.
@Override
protected JComponent createCenterComponent() {
JPanel panel = new JPanel(new BorderLayout());
final JComponent component = super.createCenterComponent();
panel.add(component, BorderLayout.CENTER);
String preselect = PropertiesComponent.getInstance(myProject).getValue(SELECTED_SCOPE);
myScopes = new ScopeChooserCombo(myProject, false, true, preselect);
myScopes.setCurrentSelection(false);
myScopes.setUsageView(false);
JPanel chooserPanel = new JPanel(new GridBagLayout());
final JLabel scopesLabel = new JLabel("Scope:");
scopesLabel.setDisplayedMnemonic('S');
scopesLabel.setLabelFor(myScopes);
final GridBagConstraints gc = new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insets(2), 0, 0);
chooserPanel.add(scopesLabel, gc);
chooserPanel.add(myScopes, gc);
gc.fill = GridBagConstraints.HORIZONTAL;
gc.weightx = 1;
chooserPanel.add(Box.createHorizontalBox(), gc);
panel.add(chooserPanel, BorderLayout.NORTH);
return panel;
}
use of com.intellij.ide.util.scopeChooser.ScopeChooserCombo in project intellij-community by JetBrains.
the class FindDialog method createGlobalScopePanel.
@NotNull
private JComponent createGlobalScopePanel() {
JPanel scopePanel = new JPanel();
scopePanel.setLayout(new GridBagLayout());
scopePanel.setBorder(IdeBorderFactory.createTitledBorder(FindBundle.message("find.scope.group"), true));
GridBagConstraints gbConstraints = new GridBagConstraints();
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.anchor = GridBagConstraints.WEST;
gbConstraints.gridx = 0;
gbConstraints.gridy = 0;
gbConstraints.gridwidth = 3;
gbConstraints.weightx = 1;
final boolean canAttach = ProjectAttachProcessor.canAttachToProject();
myRbProject = new JRadioButton(canAttach ? FindBundle.message("find.scope.all.projects.radio") : FindBundle.message("find.scope.whole.project.radio"), true);
scopePanel.add(myRbProject, gbConstraints);
ItemListener resultsPreviewUpdateListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
scheduleResultsUpdate();
}
};
myRbProject.addItemListener(resultsPreviewUpdateListener);
gbConstraints.gridx = 0;
gbConstraints.gridy++;
gbConstraints.weightx = 0;
gbConstraints.gridwidth = 1;
myRbModule = new JRadioButton(canAttach ? FindBundle.message("find.scope.project.radio") : FindBundle.message("find.scope.module.radio"), false);
scopePanel.add(myRbModule, gbConstraints);
myRbModule.addItemListener(resultsPreviewUpdateListener);
gbConstraints.gridx = 1;
gbConstraints.gridwidth = 2;
gbConstraints.weightx = 1;
Module[] modules = ModuleManager.getInstance(myProject).getModules();
String[] names = new String[modules.length];
for (int i = 0; i < modules.length; i++) {
names[i] = modules[i].getName();
}
Arrays.sort(names, String.CASE_INSENSITIVE_ORDER);
myModuleComboBox = new ComboBox(names);
myModuleComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
scheduleResultsUpdate();
}
});
scopePanel.add(myModuleComboBox, gbConstraints);
if (modules.length == 1) {
myModuleComboBox.setVisible(false);
myRbModule.setVisible(false);
}
gbConstraints.gridx = 0;
gbConstraints.gridy++;
gbConstraints.weightx = 0;
gbConstraints.gridwidth = 1;
myRbDirectory = new JRadioButton(FindBundle.message("find.scope.directory.radio"), false);
scopePanel.add(myRbDirectory, gbConstraints);
myRbDirectory.addItemListener(resultsPreviewUpdateListener);
gbConstraints.gridx = 1;
gbConstraints.weightx = 1;
myDirectoryComboBox = new ComboBox(200);
Component editorComponent = myDirectoryComboBox.getEditor().getEditorComponent();
if (editorComponent instanceof JTextField) {
JTextField field = (JTextField) editorComponent;
field.setColumns(40);
}
initCombobox(myDirectoryComboBox);
myDirectoryComboBox.setSwingPopup(false);
myDirectoryComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
scheduleResultsUpdate();
}
});
scopePanel.add(myDirectoryComboBox, gbConstraints);
gbConstraints.weightx = 0;
gbConstraints.gridx = 2;
mySelectDirectoryButton = new FixedSizeButton(myDirectoryComboBox);
TextFieldWithBrowseButton.MyDoClickAction.addTo(mySelectDirectoryButton, myDirectoryComboBox);
mySelectDirectoryButton.setMargin(new Insets(0, 0, 0, 0));
scopePanel.add(mySelectDirectoryButton, gbConstraints);
gbConstraints.gridx = 0;
gbConstraints.gridy++;
gbConstraints.weightx = 1;
gbConstraints.gridwidth = 3;
gbConstraints.insets = new Insets(0, 16, 0, 0);
myCbWithSubdirectories = createCheckbox(true, FindBundle.message("find.scope.directory.recursive.checkbox"));
myCbWithSubdirectories.setSelected(true);
myCbWithSubdirectories.addItemListener(resultsPreviewUpdateListener);
scopePanel.add(myCbWithSubdirectories, gbConstraints);
gbConstraints.gridx = 0;
gbConstraints.gridy++;
gbConstraints.weightx = 0;
gbConstraints.gridwidth = 1;
gbConstraints.insets = new Insets(0, 0, 0, 0);
myRbCustomScope = new JRadioButton(FindBundle.message("find.scope.custom.radio"), false);
scopePanel.add(myRbCustomScope, gbConstraints);
gbConstraints.gridx++;
gbConstraints.weightx = 1;
gbConstraints.gridwidth = 2;
myScopeCombo = new ScopeChooserCombo();
myScopeCombo.init(myProject, true, true, FindSettings.getInstance().getDefaultScopeName(), new Condition<ScopeDescriptor>() {
//final String projectFilesScopeName = PsiBundle.message("psi.search.scope.project");
private final String moduleFilesScopeName;
{
String moduleScopeName = PsiBundle.message("search.scope.module", "");
final int ind = moduleScopeName.indexOf(' ');
moduleFilesScopeName = moduleScopeName.substring(0, ind + 1);
}
@Override
public boolean value(ScopeDescriptor descriptor) {
final String display = descriptor.getDisplay();
return /*!projectFilesScopeName.equals(display) &&*/
!display.startsWith(moduleFilesScopeName);
}
});
myScopeCombo.getComboBox().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
scheduleResultsUpdate();
}
});
myRbCustomScope.addItemListener(resultsPreviewUpdateListener);
Disposer.register(myDisposable, myScopeCombo);
scopePanel.add(myScopeCombo, gbConstraints);
ButtonGroup bgScope = new ButtonGroup();
bgScope.add(myRbProject);
bgScope.add(myRbModule);
bgScope.add(myRbDirectory);
bgScope.add(myRbCustomScope);
myRbProject.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateScopeControls();
validateFindButton();
}
});
myRbCustomScope.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateScopeControls();
validateFindButton();
myScopeCombo.getComboBox().requestFocusInWindow();
}
});
myRbDirectory.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateScopeControls();
validateFindButton();
myDirectoryComboBox.getEditor().getEditorComponent().requestFocusInWindow();
}
});
myRbModule.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateScopeControls();
validateFindButton();
myModuleComboBox.requestFocusInWindow();
}
});
mySelectDirectoryButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
FileChooser.chooseFiles(descriptor, myProject, null, files -> myDirectoryComboBox.setSelectedItem(files.get(0).getPresentableUrl()));
}
});
return scopePanel;
}
use of com.intellij.ide.util.scopeChooser.ScopeChooserCombo in project intellij-plugins by JetBrains.
the class CPUSnapshotView method createUIComponents.
private void createUIComponents() {
myTracesTreeTable = new CallTreeTable(getProject());
createHotSpotsTreeTable();
myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, this);
filterScope = new ScopeChooserCombo(getProject(), true, false, ProjectFilesScope.NAME);
}
use of com.intellij.ide.util.scopeChooser.ScopeChooserCombo in project intellij-plugins by JetBrains.
the class LiveObjectsView method createUIComponents.
private void createUIComponents() {
liveObjectsTreeTable = new LiveObjectsTreeTable(getProject());
filterScope = new ScopeChooserCombo(getProject(), true, false, ProjectFilesScope.NAME);
}
Aggregations