Plugin - mark or color or evidence a row in text editor [message #1648057] |
Tue, 03 March 2015 18:56 |
Tomas Bortoli Messages: 5 Registered: March 2015 |
Junior Member |
|
|
Hi everybody. I'm new to plugin development in eclipse, and I'm trying to achieve this task. I've done a popup menu with target ID="#TextEditorContext" (in plugin.xml) so it appear into the text editor when I press the right button of the mouse. Then my problem is evidencing a row. Here is the code of my Mark class that handles the context menu interactions.
package com.slicerplugin.popup.actions;
import java.awt.Color;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
public class Mark implements IEditorActionDelegate {
private Shell shell;
/**
* Constructor for Action1.
*/
public Mark() {
super();
}
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
shell = targetPart.getSite().getShell();
}
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
MessageDialog.openInformation(
shell,
action.getActionDefinitionId(),
action.getAccelerator()+" ");
}
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
MessageDialog.openInformation(
shell,
action.getActionDefinitionId(),
selection.toString());
}
@Override
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
// TODO Auto-generated method stub
MessageDialog.openInformation(
shell,
action.getActionDefinitionId(),
targetEditor.getTitle());
}
}
The code is actually pseudo random just for explore something.
Someone have idea of how can I achieve this task?????????????
Thanks thousand!
|
|
|
Powered by
FUDForum. Page generated in 0.03148 seconds