blob: 9acc1dba66d4bda4e497c6332576e3207550afc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
package com.intellij.structuralsearch.plugin;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.structuralsearch.plugin.ui.ConfigurationManager;
import com.intellij.structuralsearch.plugin.ui.ExistingTemplatesComponent;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
/**
* Structural search plugin main class.
*/
public final class StructuralSearchPlugin implements ProjectComponent, JDOMExternalizable {
private boolean searchInProgress;
private boolean replaceInProgress;
private boolean myDialogVisible;
private final ConfigurationManager myConfigurationManager = new ConfigurationManager();
private ExistingTemplatesComponent myExistingTemplatesComponent;
public boolean isSearchInProgress() {
return searchInProgress;
}
public void setSearchInProgress(boolean searchInProgress) {
this.searchInProgress = searchInProgress;
}
public boolean isReplaceInProgress() {
return replaceInProgress;
}
public void setReplaceInProgress(boolean replaceInProgress) {
this.replaceInProgress = replaceInProgress;
}
public boolean isDialogVisible() {
return myDialogVisible;
}
public void setDialogVisible(boolean dialogVisible) {
myDialogVisible = dialogVisible;
}
/**
* Method is called after plugin is already created and configured. Plugin can start to communicate with
* other plugins only in this method.
*/
public void initComponent() {
}
/**
* This method is called on plugin disposal.
*/
public void disposeComponent() {
}
/**
* Returns the name of component
*
* @return String representing component name. Use PluginName.ComponentName notation
* to avoid conflicts.
*/
@NotNull
public String getComponentName() {
return "StructuralSearchPlugin";
}
// Simple logging facility
// Logs given string to IDEA logger
private static class LoggerHolder {
private static final Logger logger = Logger.getInstance("Structural search");
}
public static void debug(String str) {
LoggerHolder.logger.info(str);
}
public void readExternal(Element element) {
myConfigurationManager.loadConfigurations(element);
}
public void writeExternal(Element element) {
myConfigurationManager.saveConfigurations(element);
}
public void projectOpened() {
}
public void projectClosed() {
}
public static StructuralSearchPlugin getInstance(Project project) {
return project.getComponent(StructuralSearchPlugin.class);
}
public ConfigurationManager getConfigurationManager() {
return myConfigurationManager;
}
public ExistingTemplatesComponent getExistingTemplatesComponent() {
return myExistingTemplatesComponent;
}
public void setExistingTemplatesComponent(ExistingTemplatesComponent existingTemplatesComponent) {
myExistingTemplatesComponent = existingTemplatesComponent;
}
}
|