Lines 49-63
Link Here
|
49 |
import java.awt.Font; |
49 |
import java.awt.Font; |
50 |
import java.awt.Graphics; |
50 |
import java.awt.Graphics; |
51 |
import java.awt.event.KeyEvent; |
51 |
import java.awt.event.KeyEvent; |
|
|
52 |
import java.net.URL; |
53 |
import javax.swing.Action; |
52 |
import javax.swing.text.*; |
54 |
import javax.swing.text.*; |
53 |
import javax.swing.Icon; |
55 |
import javax.swing.Icon; |
54 |
|
56 |
|
55 |
import org.netbeans.editor.*; |
57 |
import org.netbeans.editor.*; |
56 |
import javax.swing.JLabel; |
58 |
import javax.swing.JLabel; |
57 |
import org.netbeans.api.editor.completion.Completion; |
59 |
import org.netbeans.api.editor.completion.Completion; |
|
|
60 |
import org.netbeans.modules.xml.api.model.GrammarResult; |
58 |
import org.netbeans.modules.xml.text.api.XMLDefaultTokenContext; |
61 |
import org.netbeans.modules.xml.text.api.XMLDefaultTokenContext; |
59 |
import org.netbeans.modules.xml.text.syntax.XMLSyntaxSupport; |
62 |
import org.netbeans.modules.xml.text.syntax.XMLSyntaxSupport; |
|
|
63 |
import org.netbeans.spi.editor.completion.CompletionDocumentation; |
60 |
import org.netbeans.spi.editor.completion.CompletionItem; |
64 |
import org.netbeans.spi.editor.completion.CompletionItem; |
|
|
65 |
import org.netbeans.spi.editor.completion.CompletionResultSet; |
61 |
import org.netbeans.spi.editor.completion.CompletionTask; |
66 |
import org.netbeans.spi.editor.completion.CompletionTask; |
62 |
|
67 |
|
63 |
/** |
68 |
/** |
Lines 310-315
Link Here
|
310 |
//return new AsyncCompletionTask(new DocQuery(this)); |
315 |
//return new AsyncCompletionTask(new DocQuery(this)); |
311 |
} |
316 |
} |
312 |
|
317 |
|
|
|
318 |
/** |
319 |
* Helper method for result items providing documentation. |
320 |
* @return |
321 |
*/ |
322 |
protected CompletionTask doCreateDocumentationTask(final GrammarResult res) { |
323 |
return new CompletionTask() { |
324 |
public void query(CompletionResultSet resultSet) { |
325 |
if (res != null && res.getDescription() != null) { |
326 |
resultSet.setDocumentation(new Docum(res.getDescription())); |
327 |
|
328 |
} |
329 |
resultSet.finish(); |
330 |
} |
331 |
public void refresh(CompletionResultSet resultSet) { |
332 |
if (res != null && res.getDescription() != null) { |
333 |
resultSet.setDocumentation(new Docum(res.getDescription())); |
334 |
} |
335 |
resultSet.finish(); |
336 |
} |
337 |
public void cancel() {} |
338 |
}; |
339 |
} |
340 |
|
341 |
private static class Docum implements CompletionDocumentation { |
342 |
private String doc; |
343 |
|
344 |
private Docum(String doc) { |
345 |
this.doc = doc; |
346 |
} |
347 |
|
348 |
@Override |
349 |
public String getText() { |
350 |
return doc; |
351 |
} |
352 |
|
353 |
@Override |
354 |
public URL getURL() { |
355 |
return null; |
356 |
} |
357 |
|
358 |
@Override |
359 |
public CompletionDocumentation resolveLink(String link) { |
360 |
return null; |
361 |
} |
362 |
|
363 |
@Override |
364 |
public Action getGotoSourceAction() { |
365 |
return null; |
366 |
} |
367 |
|
368 |
} |
369 |
|
313 |
public CompletionTask createToolTipTask() { |
370 |
public CompletionTask createToolTipTask() { |
314 |
return null; |
371 |
return null; |
315 |
} |
372 |
} |