Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » adding action to the context menu of UML2Tools plugin(extending UML2Tools)
adding action to the context menu of UML2Tools plugin [message #539255] Thu, 10 June 2010 08:15 Go to next message
No real name is currently offline No real nameFriend
Messages: 8
Registered: June 2010
Junior Member
I have to add action to the context menu of UML2Tools editor for class diagram and sequence diagram.What is the target id for object contribution?
Could anyone guide me please.
Deepali

[Updated on: Thu, 10 June 2010 08:18]

Report message to a moderator

Re: adding action to the context menu of UML2Tools plugin [message #539904 is a reply to message #539255] Mon, 14 June 2010 09:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hello,
open the desired editor and press ctrl+shift+F1 and the plugin spy gives
you the active menu contribution identifier for the UMLTools class
diagram editor:
org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu

best regards

deepalijayantjoshi@gmail.com wrote:
> I have to add action to the context menu of UML2Tools editor for class
> diagram and sequence diagram.What is the target id for object contribution?
> Could anyone guide me please.
Re: adding action to the context menu of UML2Tools plugin [message #541058 is a reply to message #539904] Fri, 18 June 2010 08:07 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 8
Registered: June 2010
Junior Member
Thanks a lot for your guidance.
I have another query.
I want to open an file .umlclass in Eclipse as a text file .How will I able to do it?Do I need to study EFS for it or it is possible through java file handling?
Please Help!
Deepali
Re: adding action to the context menu of UML2Tools plugin [message #541097 is a reply to message #541058] Fri, 18 June 2010 10:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

what about right-clicking the file and invoke "open with..."? There you
can choose a text editor or at least an xml editor. If that's not the
solution I don't understand your problem.

best regards,
Gilbert

deepalijayantjoshi@gmail.com wrote:
> Thanks a lot for your guidance.
> I have another query.
> I want to open an file .umlclass in Eclipse as a text file .How will I
> able to do it?Do I need to study EFS for it or it is possible through
> java file handling?
> Please Help!
> Deepali
Re: adding action to the context menu of UML2Tools plugin [message #541708 is a reply to message #541097] Tue, 22 June 2010 09:37 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 8
Registered: June 2010
Junior Member
Hi Gilbert ,
Thanks for your reply Smile
what I want to do is write a java program to read a file and attach it to an action in the context menu of the UML2 Tools Editor.
I have the java pgm .How shall I link it to action of the context menu of the UML2 Tools Editor?
I tried it by following method but its not working:

import java.io.BufferedReader;
import java.io.FileReader;

import org.eclipse.jface.action.IAction;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;

public class EditorAction2Delegate
extends ActionDelegate
implements IEditorActionDelegate {
public static void main(String[] args)throws Exception
{

}
public void run(IAction action) {
MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindo w().getShell());
box.setMessage("Executing: " + getClass());
box.open();
System.out.println("hi sdfhsdhfisduh");
FileReader fr = new FileReader("1.uml");
BufferedReader br = new BufferedReader(fr);
String s;
while((s = br.readLine()) != null) {
System.out.println(s);
}
fr.close();
}


/**
* @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
*/
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
}

I am getting the message box but the file is not read.
I hope you will not get my problem
wainting for reply
Deepali
Re: adding action to the context menu of UML2Tools plugin [message #625644 is a reply to message #539904] Fri, 18 June 2010 08:07 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 8
Registered: June 2010
Junior Member
Thanks a lot for your guidance.
I have another query.
I want to open an file .umlclass in Eclipse as a text file .How will I able to do it?Do I need to study EFS for it or it is possible through java file handling?
Please Help!
Deepali
Re: adding action to the context menu of UML2Tools plugin [message #625645 is a reply to message #625644] Fri, 18 June 2010 10:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

what about right-clicking the file and invoke "open with..."? There you
can choose a text editor or at least an xml editor. If that's not the
solution I don't understand your problem.

best regards,
Gilbert

deepalijayantjoshi@gmail.com wrote:
> Thanks a lot for your guidance.
> I have another query.
> I want to open an file .umlclass in Eclipse as a text file .How will I
> able to do it?Do I need to study EFS for it or it is possible through
> java file handling?
> Please Help!
> Deepali
Re: adding action to the context menu of UML2Tools plugin [message #625800 is a reply to message #541097] Tue, 22 June 2010 09:37 Go to previous message
No real name is currently offline No real nameFriend
Messages: 8
Registered: June 2010
Junior Member
Hi Gilbert ,
Thanks for your reply :)
what I want to do is write a java program to read a file and attach it to an action in the context menu of the UML2 Tools Editor.
I have the java pgm .How shall I link it to action of the context menu of the UML2 Tools Editor?
I tried it by following method but its not working:

import java.io.BufferedReader;
import java.io.FileReader;

import org.eclipse.jface.action.IAction;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;

public class EditorAction2Delegate
extends ActionDelegate
implements IEditorActionDelegate {
public static void main(String[] args)throws Exception
{

}
public void run(IAction action) {
MessageBox box = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindo w().getShell());
box.setMessage("Executing: " + getClass());
box.open();
System.out.println("hi sdfhsdhfisduh");
FileReader fr = new FileReader("1.uml");
BufferedReader br = new BufferedReader(fr);
String s;
while((s = br.readLine()) != null) {
System.out.println(s);
}
fr.close();
}


/**
* @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
*/
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
}

I am getting the message box but the file is not read.
I hope you will not get my problem
wainting for reply
Deepali
Previous Topic:Specifying guards in activity diagrams
Next Topic:How to fetch the name of the current active file in UML editor at runtime
Goto Forum:
  


Current Time: Wed Nov 26 17:23:49 GMT 2014

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

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