Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] how to get CProject in a function "EditorActionDelegate1 implements IEditorActionDelegate"

Hi all,
      I added a derived class to IEditorActionDelegate for getting the selected text in C Editor. I want to know, how can I get in which file the text has been selected? In which project the file is located? 

     public class EditorActionDelegate1 implements IEditorActionDelegate {
private String textSelected;
@Override
public void setActiveEditor(IAction action, IEditorPart targetEditor) {

}

@Override
public void run(IAction action) {
System.out.println("Dans la fonction run dans EditorActionDelegate");
}
public String getTextSelected(){
return this.textSelected;
}
@Override
public void selectionChanged(IAction action, ISelection sel) {
System.out.println("Dans la fonction selectionChanged");
System.out.println(sel);
if(sel instanceof TextSelection){
System.out.println("text selection");
System.out.println(((TextSelection)sel).getText());
//recupererLesDocCorrespondant;
//afficherLaBulle
}

Thanks in advance,

Back to the top