Skip to content

Commit ed66b10

Browse files
author
saharmehrpour
committed
moved index.html content to java class
1 parent 480aae9 commit ed66b10

1 file changed

Lines changed: 42 additions & 4 deletions

File tree

src/GrepServerToolWindowFactory.java

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,48 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
9595

9696
private synchronized void publishServices() {
9797
try {
98-
// webEngine.setJavaScriptEnabled(true);
99-
// webEngine.load("http://localhost:3000/");
100-
File file = new File(this.getClass().getClassLoader().getResource("").getPath() + "index.html");
101-
webEngine.load(file.toURI().toURL().toString());
98+
99+
String content = "<!doctype html>\n" +
100+
"<html lang=\"en\">\n" +
101+
"<head>\n" +
102+
" <meta charset=\"utf-8\">\n" +
103+
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n" +
104+
" <meta name=\"theme-color\" content=\"#000000\">\n" +
105+
"\n" +
106+
" <title>Active Documentation</title>\n" +
107+
"\n" +
108+
"</head>\n" +
109+
"<body style='font-family: \"Helvetica Neue\",Helvetica,Arial,sans-serif;font-size: 14px;line-height: 1.42857143;'>\n" +
110+
"<div style=\"margin: 20%\">Connected to the server.<br>\n" +
111+
" <ol>\n" +
112+
" <li>Open the Terminal.</li>\n" +
113+
" <li>Direct to the <strong>active-doc-client</strong> directory.</li>\n" +
114+
" <li>Run command <span style=\"font-family: monospace; background-color: antiquewhite;\">npm run start</span> to\n" +
115+
" start the application.\n" +
116+
" </li>\n" +
117+
" <li>The <em>npm</em> prints the address in which the tool is served in form of: <span\n" +
118+
" style=\"color: #337ab7;text-decoration: none;background-color: transparent;\">http://localhost:&lt;PORT&gt;</span>\n" +
119+
" </li>\n" +
120+
" <li>Open the URL in Chrome.</li>\n" +
121+
" </ol>\n" +
122+
" If the tool is running slow:\n" +
123+
" <ol>\n" +
124+
" <li>Stop the application using <kbd>ctrl</kbd>+<kbd>C</kbd>.</li>\n" +
125+
" <li>Change the port number in <strong>package.json</strong> in <strong>active-doc-client</strong> directory.</li>\n" +
126+
" <li>Restart the app using <span style=\"font-family: monospace; background-color: antiquewhite;\">npm run start</span>.</li>\n" +
127+
" <li>Open the new given URL in Chrome.</li>\n" +
128+
" </ol>\n" +
129+
"\n" +
130+
"</div>\n" +
131+
"</body>\n" +
132+
"</html>";
133+
webEngine.loadContent(content, "text/html");
134+
135+
136+
// webEngine.setJavaScriptEnabled(true);
137+
// webEngine.load("http://localhost:3000/");
138+
// File file = new File(this.getClass().getClassLoader().getResource("").getPath() + "index.html");
139+
// webEngine.load(file.toURI().toURL().toString());
102140
} catch (Exception ex) {
103141
System.err.print("error " + ex.getMessage());
104142
ex.printStackTrace();

0 commit comments

Comments
 (0)