-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
azerr
committed
Nov 7, 2022
1 parent
f002ea8
commit 1351aed
Showing
5 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...per.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/FindReferencesHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.eclipse.wildwebdeveloper.xml.internal.commands; | ||
|
||
import java.util.Map; | ||
|
||
import org.eclipse.core.commands.ExecutionEvent; | ||
import org.eclipse.core.commands.ExecutionException; | ||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.jface.text.BadLocationException; | ||
import org.eclipse.jface.text.IDocument; | ||
import org.eclipse.lsp4e.LSPEclipseUtils; | ||
import org.eclipse.lsp4e.command.LSPCommandHandler; | ||
import org.eclipse.lsp4j.Command; | ||
import org.eclipse.lsp4j.Position; | ||
import org.eclipse.ui.IEditorPart; | ||
import org.eclipse.ui.handlers.HandlerUtil; | ||
import org.eclipse.ui.texteditor.ITextEditor; | ||
import org.eclipse.wildwebdeveloper.xml.internal.Activator; | ||
|
||
public class FindReferencesHandler extends LSPCommandHandler { | ||
|
||
@Override | ||
public Object execute(ExecutionEvent event, Command command, IPath path) throws ExecutionException { | ||
IEditorPart part = HandlerUtil.getActiveEditor(event); | ||
if (part instanceof ITextEditor editor) { | ||
IDocument document = LSPEclipseUtils.getDocument(editor); | ||
if (document == null) { | ||
return null; | ||
} | ||
try { | ||
Map<String, Object> position = (Map<String, Object>) command.getArguments().get(1); | ||
int line = ((Number) position.get("line")).intValue(); | ||
int character = ((Number) position.get("character")).intValue(); | ||
int offset = LSPEclipseUtils.toOffset(new Position(line, character), document); | ||
LSPEclipseUtils.searchLSPReferences(document, offset, HandlerUtil.getActiveShell(event).getDisplay()); | ||
} catch (BadLocationException e) { | ||
Activator.getDefault().getLog().error("Error while getting offset for references", e); | ||
} | ||
} | ||
return null; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...bdeveloper.xml/src/org/eclipse/wildwebdeveloper/xml/internal/commands/OpenUriHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.eclipse.wildwebdeveloper.xml.internal.commands; | ||
|
||
import org.eclipse.core.commands.ExecutionEvent; | ||
import org.eclipse.core.commands.ExecutionException; | ||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.lsp4e.command.LSPCommandHandler; | ||
import org.eclipse.lsp4j.Command; | ||
|
||
public class OpenUriHandler extends LSPCommandHandler { | ||
|
||
@Override | ||
public Object execute(ExecutionEvent event, Command command, IPath path) throws ExecutionException { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
} |