mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: remove unneeded static Project field hack
This commit is contained in:
+8
-12
@@ -109,11 +109,11 @@ class EditVarConstraintsDialog extends DialogWrapper {
|
||||
private JButton myOneInfinityButton;
|
||||
private JButton myZeroOneButton;
|
||||
|
||||
private static Project myProject;
|
||||
private final Project myProject;
|
||||
|
||||
EditVarConstraintsDialog(final Project project, Configuration configuration, List<Variable> _variables, final FileType fileType) {
|
||||
super(project, true);
|
||||
|
||||
myProject = project;
|
||||
variables = _variables;
|
||||
myConfiguration = configuration;
|
||||
|
||||
@@ -543,21 +543,21 @@ class EditVarConstraintsDialog extends DialogWrapper {
|
||||
myRegExHelpLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
|
||||
}
|
||||
|
||||
private static EditorTextField createRegexComponent() {
|
||||
private EditorTextField createRegexComponent() {
|
||||
@NonNls final String fileName = "1.regexp";
|
||||
final FileType fileType = getFileType(fileName);
|
||||
final Document doc = createDocument(fileName, fileType, "");
|
||||
return new EditorTextField(doc, myProject, fileType);
|
||||
}
|
||||
|
||||
private static EditorTextField createScriptComponent() {
|
||||
private EditorTextField createScriptComponent() {
|
||||
@NonNls final String fileName = "1.groovy";
|
||||
final FileType fileType = getFileType(fileName);
|
||||
final Document doc = createDocument(fileName, fileType, "");
|
||||
return new EditorTextField(doc, myProject, fileType);
|
||||
}
|
||||
|
||||
private static Document createDocument(final String fileName, final FileType fileType, String text) {
|
||||
private Document createDocument(final String fileName, final FileType fileType, String text) {
|
||||
final PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText(fileName, fileType, text, -1, true);
|
||||
|
||||
return PsiDocumentManager.getInstance(myProject).getDocument(file);
|
||||
@@ -569,10 +569,6 @@ class EditVarConstraintsDialog extends DialogWrapper {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public static void setProject(final Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
private static class MyChangeListener implements ChangeListener {
|
||||
private final JComponent component;
|
||||
private final boolean inverted;
|
||||
@@ -605,7 +601,7 @@ class EditVarConstraintsDialog extends DialogWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
static Editor createEditor(final Project project, final String text, final String fileName) {
|
||||
Editor createEditor(final Project project, final String text, final String fileName) {
|
||||
final FileType fileType = getFileType(fileName);
|
||||
final Document doc = createDocument(fileName, fileType, text);
|
||||
final Editor editor = EditorFactory.getInstance().createEditor(doc, project);
|
||||
@@ -622,11 +618,11 @@ class EditVarConstraintsDialog extends DialogWrapper {
|
||||
return editor;
|
||||
}
|
||||
|
||||
private static class EditScriptDialog extends DialogWrapper {
|
||||
private class EditScriptDialog extends DialogWrapper {
|
||||
private final Editor editor;
|
||||
private final String title;
|
||||
|
||||
public EditScriptDialog(Project project, String text, Collection<String> names) {
|
||||
EditScriptDialog(Project project, String text, Collection<String> names) {
|
||||
super(project, true);
|
||||
setTitle(SSRBundle.message("edit.groovy.script.constraint.title"));
|
||||
editor = createEditor(project, text, "1.groovy");
|
||||
|
||||
+3
-9
@@ -177,7 +177,7 @@ public class SearchDialog extends DialogWrapper {
|
||||
return editor;
|
||||
}
|
||||
|
||||
private void initiateValidation() {
|
||||
void initiateValidation() {
|
||||
myAlarm.cancelAllRequests();
|
||||
myAlarm.addRequest(() -> {
|
||||
try {
|
||||
@@ -613,22 +613,18 @@ public class SearchDialog extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
EditVarConstraintsDialog.setProject(searchContext.getProject());
|
||||
new EditVarConstraintsDialog(
|
||||
searchContext.getProject(),
|
||||
model.getConfig(), getVariablesFromListeners(),
|
||||
(FileType)fileTypes.getSelectedItem()
|
||||
).show();
|
||||
initiateValidation();
|
||||
EditVarConstraintsDialog.setProject(null);
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
panel.add(
|
||||
Box.createHorizontalStrut(8)
|
||||
);
|
||||
panel.add(Box.createHorizontalStrut(8));
|
||||
|
||||
panel.add(
|
||||
createJButtonForAction(
|
||||
@@ -652,9 +648,7 @@ public class SearchDialog extends DialogWrapper {
|
||||
)
|
||||
);
|
||||
|
||||
panel.add(
|
||||
Box.createHorizontalStrut(8)
|
||||
);
|
||||
panel.add(Box.createHorizontalStrut(8));
|
||||
|
||||
panel.add(
|
||||
createJButtonForAction(
|
||||
|
||||
Reference in New Issue
Block a user