Skip to content

Commit

Permalink
fix #26
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelmas committed Jul 26, 2014
1 parent 54cffde commit e6fc4a6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/de/dreamlab/dash/keywords/SqlDialectDependentKeyword.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
package de.dreamlab.dash.keywords;

import com.intellij.lang.Language;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import de.dreamlab.dash.LookupInfoDictionary;

import java.lang.reflect.Method;
import java.util.HashMap;

public class SqlDialectDependentKeyword implements IKeyword {
Expand Down Expand Up @@ -51,10 +57,13 @@ private void setDictFileSqlLanguage(LookupInfoDictionary dict)
Language language = null;

try {
Class.forName("com.intellij.sql.dialects.SqlDialectMappings");
language = com.intellij.sql.dialects.SqlDialectMappings.getMapping(dict.getProject(), dict.getVirtualFile());
// using reflection for the following command, because of optional dependencies
// language = com.intellij.sql.dialects.SqlDialectMappings.getMapping(dict.getProject(), dict.getVirtualFile());
Class sqlClass = Class.forName("com.intellij.sql.dialects.SqlDialectMappings");
Method getMappingMethod = sqlClass.getMethod("getMapping", Project.class, VirtualFile.class);
language = (Language)getMappingMethod.invoke(null, dict.getProject(), dict.getVirtualFile());
}
catch (ClassNotFoundException e) {
catch (Throwable e) {
}

dict.setFileSqlLanguage(language);
Expand Down

0 comments on commit e6fc4a6

Please sign in to comment.