/* (non-Javadoc) * @see fr.istic.aco.editor.core.MiniEditorEngine#editorSelect(int, int) */ @Override public void editorSelect(int start, int stop) { if ((start == 0 && stop == 0) || (stop < start)) { System.out.println("<<<<ALERT : Invalid or no start and stop index>>>>"); } selection.setStart(start); selection.setStop(stop); }
/* (non-Javadoc) * @see fr.istic.aco.editor.core.MiniEditorEngine#editorCopy() */ @Override public void editorCopy() { if (selection.getStart() == 0 && selection.getStop() == 0) { System.out.println("<<<<ALERT : No Range selected to do copy operation>>>>"); } else { clipboard.setLine(buffer.read(selection.getStart(), selection.getStop())); System.out.println("DEBUG: Copy Operation done : Now we have " + clipboard.getLine()); } }
/* (non-Javadoc) * @see fr.istic.aco.editor.core.MiniEditorEngine#editorCut() */ @Override public void editorCut() { /*if(selection.getStart()==0 && selection.getStop()==0) { System.out.println("<<<<ALERT : No Range selected to do cut operation>>>>"); } else {*/ clipboard.setLine(buffer.read(selection.getStart(), selection.getStop())); buffer.write(selection.getStart(), selection.getStop(), ""); System.out.println("DEBUG: Cut Operation done : Now we have " + clipboard.getLine()); // } }
/* (non-Javadoc) * @see fr.istic.aco.editor.core.MiniEditorEngine#editorInsert(java.lang.String) */ @Override public void editorInsert(String substring) { if ((selection.getStop() - selection.getStart()) == 0) { if (buffer.getLine() != null) { buffer.setLine(buffer.getLine().concat(substring)); } else { buffer.setLine(substring); } } else { buffer.write(selection.getStart(), selection.getStop(), substring); } }
/* (non-Javadoc) * @see fr.istic.aco.editor.core.MiniEditorEngine#editorPaste() */ @Override public void editorPaste() { if (clipboard.getLine() != null) buffer.write(selection.getStart(), selection.getStop(), clipboard.getLine()); else System.out.println("<<<<ALERT : Nothing to Paste from ClipBoard>>>>"); }