Skip to content

Commit 5633b88

Browse files
committed
JSLanguageCompilerToolWindowManager: NoClassDefFoundError in WebStorm 2016.2 EAP (#13)
1 parent 9893de9 commit 5633b88

File tree

7 files changed

+403
-14
lines changed

7 files changed

+403
-14
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.3.1 (2016-06-09)
2+
3+
Changes:
4+
5+
- Closes #13 JSLanguageCompilerToolWindowManager: NoClassDefFoundError in WebStorm 2016.2 EAP
6+
- Language Service 1.1.2 increases maximum size of JSON schema from 100kb to 32mb
7+
18
## 1.3.0 (2016-05-21)
29

310
Features:

resources/META-INF/plugin.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<idea-plugin version="2">
1111
<id>com.intellij.lang.jsgraphql</id>
1212
<name>JS GraphQL</name>
13-
<version>1.3.0</version>
13+
<version>1.3.1</version>
1414
<vendor>Jim Kynde Meyer - [email protected]</vendor>
1515

1616
<description><![CDATA[
@@ -29,6 +29,7 @@
2929

3030
<change-notes><![CDATA[
3131
<ul>
32+
<li>1.3.1: Fixes compatibility issue with WebStorm 2016.2 EAP.</li>
3233
<li>1.3.0: Adds support for GraphQL Scratch Files. Query results are now formatted.</li>
3334
<li>1.2.0: Contextual query support: Execute buffer, selection, or named operations at the caret position in the GraphQL editor</li>
3435
<li>1.1.1: Completion after ... fragment spread operator. Language Service 1.1.1 based on graphql 0.4.16 and codemirror-graphql 0.2.2</li>

src/main/com/intellij/lang/jsgraphql/ide/annotator/JSGraphQLAnnotator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
import com.intellij.lang.annotation.AnnotationHolder;
1212
import com.intellij.lang.annotation.ExternalAnnotator;
1313
import com.intellij.lang.annotation.HighlightSeverity;
14-
import com.intellij.lang.javascript.compiler.JSLanguageCompilerResult;
1514
import com.intellij.lang.javascript.psi.JSFile;
1615
import com.intellij.lang.javascript.psi.ecma6.JSStringTemplateExpression;
1716
import com.intellij.lang.jsgraphql.ide.project.JSGraphQLLanguageUIProjectService;
1817
import com.intellij.lang.jsgraphql.ide.injection.JSGraphQLLanguageInjectionUtil;
18+
import com.intellij.lang.jsgraphql.ide.project.toolwindow.JSGraphQLErrorResult;
1919
import com.intellij.lang.jsgraphql.languageservice.JSGraphQLNodeLanguageServiceClient;
2020
import com.intellij.lang.jsgraphql.languageservice.api.Annotation;
2121
import com.intellij.lang.jsgraphql.languageservice.api.AnnotationsResponse;
@@ -81,7 +81,7 @@ public void apply(@NotNull PsiFile file, JSGraphQLAnnotationResult annotationRes
8181
if(annotationsReponse == null) {
8282
return;
8383
}
84-
final List<JSLanguageCompilerResult> errors = Lists.newArrayList();
84+
final List<JSGraphQLErrorResult> errors = Lists.newArrayList();
8585
final String fileName = file.getVirtualFile().getPath();
8686
for (Annotation annotation : annotationsReponse.getAnnotations()) {
8787
LogicalPosition from = getLogicalPosition(annotation.getFrom());
@@ -92,7 +92,7 @@ public void apply(@NotNull PsiFile file, JSGraphQLAnnotationResult annotationRes
9292
if (fromOffset < toOffset) {
9393
final String message = StringUtils.substringBefore(annotation.getMessage(), "\n");
9494
holder.createAnnotation(severity, TextRange.create(fromOffset, toOffset), message);
95-
errors.add(new JSLanguageCompilerResult(message, fileName, annotation.getSeverity(), from.line+1, from.column+1)); // +1 is for UI lines/columns
95+
errors.add(new JSGraphQLErrorResult(message, fileName, annotation.getSeverity(), from.line+1, from.column+1)); // +1 is for UI lines/columns
9696
}
9797
}
9898
JSGraphQLLanguageUIProjectService jsGraphQLLanguageUIProjectService = JSGraphQLLanguageUIProjectService.getService(file.getProject());

src/main/com/intellij/lang/jsgraphql/ide/project/JSGraphQLLanguageUIProjectService.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
import com.intellij.ide.projectView.ProjectView;
2424
import com.intellij.ide.projectView.impl.ProjectViewPane;
2525
import com.intellij.json.JsonFileType;
26-
import com.intellij.lang.javascript.compiler.JSLanguageCompilerResult;
27-
import com.intellij.lang.javascript.compiler.ui.JSLanguageCompilerToolWindowManager;
28-
import com.intellij.lang.javascript.compiler.ui.JSLanguageErrorTreeViewPanel;
2926
import com.intellij.lang.javascript.psi.JSFile;
3027
import com.intellij.lang.jsgraphql.JSGraphQLFileType;
3128
import com.intellij.lang.jsgraphql.JSGraphQLParserDefinition;
@@ -39,6 +36,9 @@
3936
import com.intellij.lang.jsgraphql.ide.editor.JSGraphQLQueryContextHighlightVisitor;
4037
import com.intellij.lang.jsgraphql.ide.endpoints.JSGraphQLEndpoint;
4138
import com.intellij.lang.jsgraphql.ide.endpoints.JSGraphQLEndpointsModel;
39+
import com.intellij.lang.jsgraphql.ide.project.toolwindow.JSGraphQLErrorResult;
40+
import com.intellij.lang.jsgraphql.ide.project.toolwindow.JSGraphQLLanguageToolWindowManager;
41+
import com.intellij.lang.jsgraphql.ide.project.toolwindow.JSGraphQLErrorTreeViewPanel;
4242
import com.intellij.lang.jsgraphql.languageservice.JSGraphQLNodeLanguageServiceClient;
4343
import com.intellij.lang.jsgraphql.languageservice.JSGraphQLNodeLanguageServiceInstance;
4444
import com.intellij.lang.jsgraphql.psi.JSGraphQLFile;
@@ -130,13 +130,13 @@ public class JSGraphQLLanguageUIProjectService implements Disposable, FileEditor
130130

131131
private static final String FILE_URL_PROPERTY = "fileUrl";
132132

133-
private final JSLanguageCompilerToolWindowManager myToolWindowManager;
133+
private final JSGraphQLLanguageToolWindowManager myToolWindowManager;
134134
private boolean myToolWindowManagerInitialized = false;
135135

136136
@NotNull
137137
private final Project myProject;
138138

139-
private final Map<String, ImmutableList<JSLanguageCompilerResult>> fileUriToErrors = Maps.newConcurrentMap();
139+
private final Map<String, ImmutableList<JSGraphQLErrorResult>> fileUriToErrors = Maps.newConcurrentMap();
140140

141141
private final Object myLock = new Object();
142142

@@ -158,7 +158,7 @@ public void actionPerformed(AnActionEvent e) {
158158
};
159159

160160
// tool window
161-
myToolWindowManager = new JSLanguageCompilerToolWindowManager(project, GRAPH_QL_TOOL_WINDOW_NAME, GRAPH_QL_TOOL_WINDOW_NAME, JSGraphQLIcons.UI.GraphQLNode, restartInstanceAction);
161+
myToolWindowManager = new JSGraphQLLanguageToolWindowManager(project, GRAPH_QL_TOOL_WINDOW_NAME, GRAPH_QL_TOOL_WINDOW_NAME, JSGraphQLIcons.UI.GraphQLNode, restartInstanceAction);
162162
Disposer.register(this, this.myToolWindowManager);
163163

164164
// listen for editor file tab changes to update the list of current errors
@@ -214,8 +214,8 @@ private static void showToolWindowContent(@NotNull Project project, @NotNull Cla
214214
});
215215
}
216216

217-
public void logErrorsInCurrentFile(@NotNull PsiFile file, List<JSLanguageCompilerResult> errors) {
218-
final ImmutableList<JSLanguageCompilerResult> errorsList = ContainerUtil.immutableList(errors);
217+
public void logErrorsInCurrentFile(@NotNull PsiFile file, List<JSGraphQLErrorResult> errors) {
218+
final ImmutableList<JSGraphQLErrorResult> errorsList = ContainerUtil.immutableList(errors);
219219
fileUriToErrors.put(file.getVirtualFile().getUrl(), errorsList);
220220
UIUtil.invokeLaterIfNeeded(() -> {
221221
myToolWindowManager.logCurrentErrors(errorsList, false);
@@ -534,7 +534,7 @@ private void setHeadersFromOptions(JSGraphQLEndpoint endpoint, PostMethod method
534534
// -- instance management --
535535

536536
private void logErrorsForFile(VirtualFile file, boolean forceRefresh) {
537-
ImmutableList<JSLanguageCompilerResult> currentErrors = fileUriToErrors.get(file.getUrl());
537+
ImmutableList<JSGraphQLErrorResult> currentErrors = fileUriToErrors.get(file.getUrl());
538538
if(currentErrors != null) {
539539
if(forceRefresh) {
540540
myToolWindowManager.logCurrentErrors(ContainerUtil.immutableList(Collections.emptyList()), false);
@@ -655,7 +655,7 @@ private void initToolWindow() {
655655
final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(GRAPH_QL_TOOL_WINDOW_NAME);
656656
if(toolWindow != null) {
657657
for (Content content : toolWindow.getContentManager().getContents()) {
658-
if(content.isCloseable() && content.getComponent() instanceof JSLanguageErrorTreeViewPanel) {
658+
if(content.isCloseable() && content.getComponent() instanceof JSGraphQLErrorTreeViewPanel) {
659659
toolWindow.getContentManager().removeContent(content, true);
660660
}
661661
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Copyright (c) 2015-present, Jim Kynde Meyer
3+
* All rights reserved.
4+
* <p>
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
package com.intellij.lang.jsgraphql.ide.project.toolwindow;
9+
10+
/**
11+
* Represents an error in the GraphQL tool window error tree.
12+
*/
13+
public class JSGraphQLErrorResult {
14+
15+
final int myColumn;
16+
final int myLine;
17+
final String myErrorText;
18+
final String myCategory;
19+
final String myFileAbsoluteSystemDependPath;
20+
21+
public JSGraphQLErrorResult(String errorText, String fileAbsolutePath, String category, int line, int column) {
22+
myCategory = category;
23+
myColumn = column - 1;
24+
myLine = line - 1;
25+
myErrorText = errorText;
26+
myFileAbsoluteSystemDependPath = fileAbsolutePath;
27+
}
28+
29+
@Override
30+
public boolean equals(Object o) {
31+
if (this == o) return true;
32+
if (o == null || getClass() != o.getClass()) return false;
33+
final JSGraphQLErrorResult that = (JSGraphQLErrorResult) o;
34+
if (myColumn != that.myColumn) return false;
35+
if (myLine != that.myLine) return false;
36+
if (myErrorText != null ? !myErrorText.equals(that.myErrorText) : that.myErrorText != null) return false;
37+
return myCategory != null ? myCategory.equals(that.myCategory) : that.myCategory == null && (myFileAbsoluteSystemDependPath != null ? myFileAbsoluteSystemDependPath.equals(that.myFileAbsoluteSystemDependPath) : that.myFileAbsoluteSystemDependPath == null);
38+
}
39+
40+
public int hashCode() {
41+
int result = myColumn;
42+
result = 31 * result + myLine;
43+
result = 31 * result + (myErrorText != null ? myErrorText.hashCode() : 0);
44+
result = 31 * result + (myCategory != null ? myCategory.hashCode() : 0);
45+
result = 31 * result + (myFileAbsoluteSystemDependPath != null ? myFileAbsoluteSystemDependPath.hashCode() : 0);
46+
return result;
47+
}
48+
49+
public String toString() {
50+
return "JSGraphQLErrorResult{myColumn=" + myColumn + ", myLine=" + myLine + ", myErrorText=\'" + myErrorText + '\'' + ", myCategory=\'" + myCategory + '\'' + ", myFileAbsoluteSystemDependPath=\'" + myFileAbsoluteSystemDependPath + '\'' + '}';
51+
}
52+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/**
2+
* Copyright (c) 2015-present, Jim Kynde Meyer
3+
* All rights reserved.
4+
* <p>
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
package com.intellij.lang.jsgraphql.ide.project.toolwindow;
9+
10+
import com.intellij.icons.AllIcons.Actions;
11+
import com.intellij.ide.CommonActionsManager;
12+
import com.intellij.ide.TreeExpander;
13+
import com.intellij.ide.actions.CloseTabToolbarAction;
14+
import com.intellij.ide.actions.ContextHelpAction;
15+
import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel;
16+
import com.intellij.openapi.actionSystem.*;
17+
import com.intellij.openapi.project.DumbAwareAction;
18+
import com.intellij.openapi.project.Project;
19+
import org.jetbrains.annotations.Nullable;
20+
21+
import javax.swing.*;
22+
import java.awt.*;
23+
24+
/**
25+
* Tree view panel showing current GraphQL errors.
26+
*/
27+
public class JSGraphQLErrorTreeViewPanel extends NewErrorTreeViewPanel {
28+
private final String myHelpId;
29+
private final Runnable myCleanAction;
30+
@Nullable
31+
private final AnAction[] myActions;
32+
private TreeExpander myTreeExpander;
33+
34+
JSGraphQLErrorTreeViewPanel(Project project, String helpId, @Nullable Runnable cleanAction, @Nullable AnAction... actions) {
35+
super(project, helpId, false, false);
36+
myHelpId = helpId;
37+
myCleanAction = cleanAction;
38+
myActions = actions;
39+
myTreeExpander = (TreeExpander) getData(PlatformDataKeys.TREE_EXPANDER.getName());
40+
add(createToolPanel(), BorderLayout.WEST);
41+
myTree.getEmptyText().setText("No Errors");
42+
}
43+
44+
private Component createToolPanel() {
45+
CloseTabToolbarAction closeMessageViewAction = new CloseTabToolbarAction() {
46+
public void actionPerformed(AnActionEvent e) {
47+
close();
48+
}
49+
};
50+
DefaultActionGroup leftActionGroup = new DefaultActionGroup();
51+
DefaultActionGroup rightActionGroup = new DefaultActionGroup();
52+
if (myTreeExpander != null) {
53+
rightActionGroup.add(CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, this));
54+
rightActionGroup.add(CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, this));
55+
}
56+
57+
rightActionGroup.add(new DumbAwareAction("Clear All", null, Actions.GC) {
58+
public void actionPerformed(AnActionEvent e) {
59+
if (myCleanAction != null) {
60+
myCleanAction.run();
61+
}
62+
getErrorViewStructure().clear();
63+
updateTree();
64+
}
65+
});
66+
if (myActions != null) {
67+
for (AnAction rightToolbar : myActions) {
68+
leftActionGroup.add(rightToolbar);
69+
}
70+
}
71+
72+
leftActionGroup.add(new ContextHelpAction(myHelpId));
73+
leftActionGroup.add(closeMessageViewAction);
74+
final JPanel panel = new JPanel(new BorderLayout());
75+
final ActionManager actionManager = ActionManager.getInstance();
76+
final ActionToolbar leftToolbar = actionManager.createActionToolbar(ActionPlaces.COMPILER_MESSAGES_TOOLBAR, leftActionGroup, false);
77+
final ActionToolbar rightToolbar = actionManager.createActionToolbar(ActionPlaces.COMPILER_MESSAGES_TOOLBAR, rightActionGroup, false);
78+
panel.add(leftToolbar.getComponent(), BorderLayout.WEST);
79+
panel.add(rightToolbar.getComponent(), BorderLayout.CENTER);
80+
return panel;
81+
}
82+
}

0 commit comments

Comments
 (0)