Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Output text in default editor(output a string to the texteditor)
Output text in default editor [message #841502] Wed, 11 April 2012 11:58 Go to next message
Oscar Wu is currently offline Oscar WuFriend
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

Re: Output text in default editor [message #842402 is a reply to message #841502] Thu, 12 April 2012 09:04 Go to previous message
Oscar Wu is currently offline Oscar WuFriend
Messages: 2
Registered: April 2012
Junior Member
Currentl, I try it this way, but still not work...
Text text;
text = new Text(EditorsUI.DEFAULT_TEXT_EDITOR_ID, 0);
text.setText(s1);
text.paste;

in order to output string s1 to the current default editor.
Is it a possible way?
Previous Topic:Error when closing program cause of running job
Next Topic:How to move standard view to a different view category
Goto Forum:
  


Current Time: Sat Dec 20 11:32:14 GMT 2014

Powered by FUDForum. Page generated in 0.01988 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software