editor will recieve and populate the editor text area with the content of the FileRspMsg
This commit is contained in:
parent
8823e76e85
commit
d33fc8929e
5 changed files with 36 additions and 8 deletions
|
|
@ -1,11 +1,12 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import java.util.HashSet;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import zutil.log.LogUtil;
|
||||
|
||||
import com.coder.client.session.ProjectMessageListener;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.coder.client.gui.editor;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
|
@ -28,6 +29,7 @@ import com.coder.client.session.ProjectTypeRspMsgListener;
|
|||
import com.coder.server.message.CoderMessage;
|
||||
import com.coder.server.message.FileReqMsg;
|
||||
import com.coder.server.message.FileRspMsg;
|
||||
import com.coder.server.message.FileSaveReqMsg;
|
||||
import com.coder.server.message.ProjectReqMsg;
|
||||
import com.coder.server.message.ProjectRspMsg;
|
||||
import com.coder.server.message.ProjectTypeReqMsg;
|
||||
|
|
@ -148,7 +150,10 @@ public class EditorWindow extends GuiWindow {
|
|||
setErrorMessage("");
|
||||
}
|
||||
logger.fine("recieved file content for file: \""+msg.path+"\"");
|
||||
//TODO: load file content to text area
|
||||
String data = new String(msg.data, StandardCharsets.UTF_8);
|
||||
logger.fine("loading file content to edit text area");
|
||||
editTextArea.setText(data);
|
||||
editTextArea.setDisable(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -169,11 +174,13 @@ public class EditorWindow extends GuiWindow {
|
|||
setErrorMessage("");
|
||||
setupPropertySheet();
|
||||
setupFileTreeView();
|
||||
setupEditTextArea();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void willShow(){
|
||||
|
||||
editTextArea.setText("");
|
||||
editTextArea.setDisable(true);
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
|
@ -210,6 +217,7 @@ public class EditorWindow extends GuiWindow {
|
|||
}else{
|
||||
FileTreeFile file = (FileTreeFile)fileTreeItem;
|
||||
logger.fine("file " + file.getName() + " selected in the file tree. The file has the full path: \""+file.getFullPath()+"\"");
|
||||
editTextArea.setDisable(true);
|
||||
//sending file request message
|
||||
CoderMessage msg = new CoderMessage();
|
||||
msg.FileReq = new FileReqMsg();
|
||||
|
|
@ -243,6 +251,20 @@ public class EditorWindow extends GuiWindow {
|
|||
propertySheet.getItems().clear();
|
||||
|
||||
}
|
||||
|
||||
private void setupEditTextArea(){
|
||||
editTextArea.focusedProperty().addListener((observable, oldValue, newValue)->{
|
||||
if(!editTextArea.isFocused()){
|
||||
logger.fine("edit text area lost focus");
|
||||
logger.fine("will send a file save req");
|
||||
CoderMessage msg = new CoderMessage();
|
||||
msg.FileSaveReq = new FileSaveReqMsg();
|
||||
msg.FileSaveReq.path = ((FileTreeFile)fileTreeView.getSelectionModel().getSelectedItem().getValue()).getFullPath();
|
||||
msg.FileSaveReq.data = editTextArea.getText().getBytes(StandardCharsets.UTF_8);
|
||||
sessionHandler.sendMessage(msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="false" onAction="#refresh" text="Refresh">
|
||||
<Button fx:id="refreshButton" mnemonicParsing="false" onAction="#refresh" text="Refresh">
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class SelectProjectDialog extends GuiWindow {
|
|||
@FXML private Button newProjectButton;
|
||||
@FXML private Button cancelButton;
|
||||
@FXML private Button openButton;
|
||||
@FXML private Button refreshButton;
|
||||
@FXML private Label errorLabel;
|
||||
|
||||
public SelectProjectDialog(final CoderClient client) throws IOException {
|
||||
|
|
@ -201,6 +202,12 @@ public class SelectProjectDialog extends GuiWindow {
|
|||
}else if(event.getCode() == KeyCode.N && event.isControlDown()){ //CTRL+N
|
||||
logger.fine("User pressed CTRL+N");
|
||||
newProjectButton.fire();
|
||||
}else if(event.getCode() == KeyCode.R && event.isControlDown()){ //CTRL+R
|
||||
logger.fine("User pressed CTRL+R");
|
||||
refreshButton.fire();
|
||||
}else if(event.getCode() == KeyCode.F5){ //F5
|
||||
logger.fine("User pressed CTRL+R");
|
||||
refreshButton.fire();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue