Skip to content
Snippets Groups Projects
Commit e5f6c19f authored by Constantin Jucovschi's avatar Constantin Jucovschi
Browse files

towards 0.0.6

parent a0a847f0
No related branches found
No related tags found
No related merge requests found
...@@ -5,4 +5,73 @@ bin/ ...@@ -5,4 +5,73 @@ bin/
felix-cache felix-cache
.metadata .metadata
*.versionsBackup *.versionsBackup
.settings .settings
\ No newline at end of file /target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>info.kwarc.sally4</groupId> <groupId>info.kwarc.sally4</groupId>
<artifactId>sally4</artifactId> <artifactId>sally4</artifactId>
<version>0.0.4-SNAPSHOT</version> <version>0.0.6</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
......
...@@ -12,6 +12,8 @@ public interface TextDocument { ...@@ -12,6 +12,8 @@ public interface TextDocument {
String getText(); String getText();
SallyClient getClient(); SallyClient getClient();
TextRange getCurrentSelection();
void selectRange(TextRange range);
EventListener<AsyncAcceptor<AutocompleteRequest, AutocompleteResponse>> onAutocompleteRequest(EventHandler<AsyncAcceptor<AutocompleteRequest, AutocompleteResponse>> handler); EventListener<AsyncAcceptor<AutocompleteRequest, AutocompleteResponse>> onAutocompleteRequest(EventHandler<AsyncAcceptor<AutocompleteRequest, AutocompleteResponse>> handler);
} }
package info.kwarc.sally4.textbase;
public class TextPosition {
int row;
int col;
public TextPosition() {
}
@Override
public String toString() {
return String.format("(%d,%d)", row, col);
}
public TextPosition(int row, int col) {
this.row = row;
this.col = col;
}
public int getCol() {
return col;
}
public int getRow() {
return row;
}
public void setCol(int col) {
this.col = col;
}
public void setRow(int row) {
this.row = row;
}
}
package info.kwarc.sally4.textbase;
public class TextRange {
TextPosition start, end;
public TextRange() {
}
public TextRange(TextPosition start, TextPosition end) {
this.start = start;
this.end = end;
}
public TextRange(int start_row, int start_col, int end_row, int end_col) {
this.start = new TextPosition(start_row, start_col);
this.end = new TextPosition(end_row, end_col);
}
@Override
public String toString() {
return String.format("%s-%s", start, end);
}
public TextPosition getEnd() {
return end;
}
public TextPosition getStart() {
return start;
}
public void setEnd(TextPosition end) {
this.end = end;
}
public void setStart(TextPosition start) {
this.start = start;
}
}
...@@ -2,8 +2,14 @@ package info.kwarc.sally4.textbase.impl; ...@@ -2,8 +2,14 @@ package info.kwarc.sally4.textbase.impl;
import info.kwarc.sally.comm.text.AutocompleteRequest; import info.kwarc.sally.comm.text.AutocompleteRequest;
import info.kwarc.sally.comm.text.AutocompleteResponse; import info.kwarc.sally.comm.text.AutocompleteResponse;
import info.kwarc.sally.comm.text.GetCurrentSelection;
import info.kwarc.sally.comm.text.GetCurrentSelectionResponse;
import info.kwarc.sally.comm.text.GetText;
import info.kwarc.sally.comm.text.GetTextResponse;
import info.kwarc.sally.comm.text.SelectText;
import info.kwarc.sally4.registration.SallyClient; import info.kwarc.sally4.registration.SallyClient;
import info.kwarc.sally4.textbase.TextDocument; import info.kwarc.sally4.textbase.TextDocument;
import info.kwarc.sally4.textbase.TextRange;
import info.kwarc.sally4.util.AsyncAcceptor; import info.kwarc.sally4.util.AsyncAcceptor;
import info.kwarc.sally4.util.EventHandler; import info.kwarc.sally4.util.EventHandler;
import info.kwarc.sally4.util.EventListener; import info.kwarc.sally4.util.EventListener;
...@@ -26,9 +32,8 @@ public class TextDocumentImpl implements TextDocument { ...@@ -26,9 +32,8 @@ public class TextDocumentImpl implements TextDocument {
@Override @Override
public String getText() { public String getText() {
GetTextResponse resp = client.sendRequest(new GetText(), GetTextResponse.class);
//client.sendSimpleRequest(req, cls, response); return resp.getText();
return null;
} }
@Override @Override
...@@ -42,4 +47,20 @@ public class TextDocumentImpl implements TextDocument { ...@@ -42,4 +47,20 @@ public class TextDocumentImpl implements TextDocument {
return client; return client;
} }
@Override
public TextRange getCurrentSelection() {
GetCurrentSelectionResponse response = client.sendRequest(new GetCurrentSelection(), GetCurrentSelectionResponse.class);
return new TextRange(response.getStartrow(), response.getStartcolumn(), response.getEndrow(), response.getEndcolumn());
}
@Override
public void selectRange(TextRange range) {
SelectText st = new SelectText();
st.setStartrow(range.getStart().getRow());
st.setStartcolumn(range.getStart().getCol());
st.setEndrow(range.getEnd().getRow());
st.setEndcolumn(range.getEnd().getCol());
client.sendEvent(st);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment