21
21
import java .util .HashMap ;
22
22
import java .util .List ;
23
23
import java .util .Map ;
24
+ import com .intellij .openapi .diagnostic .Logger ;
24
25
25
26
/**
26
27
* @author Adrien Brault <adrien.brault@gmail.com>
@@ -29,6 +30,8 @@ public class Symfony2ProjectComponent implements ProjectComponent {
29
30
30
31
public static String HELP_URL = "http://symfony2-plugin.espend.de/" ;
31
32
33
+ final private static Logger LOG = Logger .getInstance ("Symfony2-Plugin" );
34
+
32
35
private Project project ;
33
36
34
37
private Map <String , Route > routes ;
@@ -60,6 +63,10 @@ public void projectClosed() {
60
63
// System.out.println("projectClosed");
61
64
}
62
65
66
+ public static Logger getLogger () {
67
+ return LOG ;
68
+ }
69
+
63
70
public void showInfoNotification (String content ) {
64
71
Notification errorNotification = new Notification ("Symfony2 Plugin" , "Symfony2 Plugin" , content , NotificationType .INFORMATION );
65
72
Notifications .Bus .notify (errorNotification , this .project );
@@ -77,6 +84,7 @@ public Map<String, Route> getRoutes() {
77
84
VirtualFile virtualUrlGeneratorFile = VfsUtil .findFileByIoFile (urlGeneratorFile , false );
78
85
79
86
if (virtualUrlGeneratorFile == null || !urlGeneratorFile .exists ()) {
87
+ Symfony2ProjectComponent .getLogger ().warn ("missing routing: " + urlGeneratorFile .toString ());
80
88
return routes ;
81
89
}
82
90
@@ -85,6 +93,8 @@ public Map<String, Route> getRoutes() {
85
93
return this .routes ;
86
94
}
87
95
96
+ Symfony2ProjectComponent .getLogger ().info ("update routing: " + urlGeneratorFile .toString ());
97
+
88
98
try {
89
99
routes = RouteHelper .getRoutes (VfsUtil .loadText (virtualUrlGeneratorFile ));
90
100
} catch (IOException e ) {
@@ -115,13 +125,16 @@ public ArrayList<File> getContainerFiles(boolean attachSetting) {
115
125
}
116
126
117
127
if (containerFiles .size () == 0 ) {
128
+ Symfony2ProjectComponent .getLogger ().info ("no custom container files add default" );
118
129
containerFiles .add (new ContainerFile (Settings .DEFAULT_CONTAINER_PATH ));
119
130
}
120
131
121
132
ArrayList <File > validFiles = new ArrayList <File >();
122
133
for (ContainerFile containerFile : containerFiles ) {
123
134
if (containerFile .exists (this .project )) {
124
135
validFiles .add (containerFile .getFile (this .project ));
136
+ } else {
137
+ Symfony2ProjectComponent .getLogger ().warn ("container file not exists skipping: " + containerFile .getPath ());
125
138
}
126
139
}
127
140
@@ -152,12 +165,14 @@ private void checkProject() {
152
165
153
166
if (this .getContainerFiles ().size () == 0 ) {
154
167
showInfoNotification ("missing at least one container file" );
168
+ Symfony2ProjectComponent .getLogger ().warn ("missing at least one container file" );
155
169
}
156
170
157
171
String urlGeneratorPath = getPath (project , Settings .getInstance (project ).pathToUrlGenerator );
158
172
File urlGeneratorFile = new File (urlGeneratorPath );
159
173
if (!urlGeneratorFile .exists ()) {
160
174
showInfoNotification ("missing routing file: " + urlGeneratorPath );
175
+ Symfony2ProjectComponent .getLogger ().warn ("missing routing file: " + urlGeneratorPath );
161
176
}
162
177
163
178
}
0 commit comments