Output text in default editor [message #841502] |
Wed, 11 April 2012 11:58 |
Oscar Wu Messages: 2 Registered: April 2012 |
Junior Member |
|
|
Hi, I am new in Elcipse, and have a question about output text in default editor. Here is the thing...
I create a contextmenu based on the contextmenu from default texteditor (org.eclipse.ui.DefaultTextEditor), when I click one button from contextmenu,it should add a string to the current texteditor, just output a string follow the current cursor position.I am a new user of eclipse.
Now I create a action, and want to output s1 in editor, but have no idea how to do it.
public class ActionCopy implements IEditorActionDelegate {
public ActionCopy() {
// TODO Auto-generated constructor stub
}
@Override
public void run(IAction action) {
// TODO Auto-generated method stub
//MessageDialog.openInformation(shell,"Editor","New Action was executed.");
s1= action.getText(); // get the action label
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
// TODO Auto-generated method stub
}
@Override
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
// TODO Auto-generated method stub
}
}
Thanks!
[Updated on: Thu, 12 April 2012 07:11] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03580 seconds