Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Integration between Graphical editor and outline view
Integration between Graphical editor and outline view [message #190669] Tue, 03 June 2008 12:46 Go to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

HI all,
i want to integrate graphical editor with my customize view part as like
as outline view part show when we drag and drag a figure from palette to
graphical editor it reflects in outline view.
I study the diagram plug in code which generated by gmfgen model
but i am not able to understand how graphical editor will reflects the
change in outline view.
If anyone have any idea about that please guide me.
Thanks in advance
Re: Integration between Graphical editor and outline view [message #190759 is a reply to message #190669] Tue, 03 June 2008 17:06 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Gaurav,

See DiagramEditor.getAdapter() method. This method will be called by Outline
View with IContentOutlinePage.class passed as a parameter, so currently DiagramEditor
itself is responsible for creating outline page contents. Looks like you
have to implement something similar to DiagramOutlinePage()..

-----------------
Alex Shatalin
Re: Integration between Graphical editor and outline view [message #190884 is a reply to message #190759] Wed, 04 June 2008 08:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

yes actually i want to make a customize outline view in which the nodes
are added as tree nodes. Can i customize the current outline view?
Re: Integration between Graphical editor and outline view [message #190918 is a reply to message #190884] Wed, 04 June 2008 11:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.urszeidler.de

gaurav bhargav wrote:
>
> yes actually i want to make a customize outline view in which the nodes
> are added as tree nodes. Can i customize the current outline view?

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=206778

greetings, urs.
Re: Integration between Graphical editor and outline view [message #191425 is a reply to message #190918] Fri, 06 June 2008 14:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

Thanks for the link,
but i am not able to implement the outline plug in which
is provided in that link, Can you please tell me how to integrate the
org.eclipse.gmf.runtime.diagram.ui.outline plug in in our graphical editor

waiting for reply
Re: Integration between Graphical editor and outline view [message #191547 is a reply to message #191425] Sat, 07 June 2008 08:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.urszeidler.de

This is a multi-part message in MIME format.
--------------090802030103030909040604
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

gaurav bhargav wrote:
> Thanks for the link, but i am not able to implement the
> outline plug in which is provided in that link, Can you please tell me
> how to integrate the org.eclipse.gmf.runtime.diagram.ui.outline plug in
> in our graphical editor
>
> waiting for reply
>
>
>
>
OK, first you need the emft ecore diagram modeler. If you are using
eclipse 3.3 you can't install it with the update site, because it need
emf 2.4. The outline itself will work in 3.3. So you grep the archive
and unpack it, just like other plug ins.
You only needed to build two classes (xxxDiagramOutlinePage and
xxxModelNavigator), and changed one method in xxxDiagramEditor,
getAdapter(Class type) where you need to create and return the
xxxDiagramOutlinePage. I have attached these files as an example.
After this the outline will be present. In 3.3 and GMF 2.01 you will
also need to add D&D by hand, as I did this for my current plug in I
just peek in the EMFT code, load it in your workspace via cvs.
The heavy part is to get the multi diagramming feature to work. I did
not really understand what's going on, I just did what I found. You will
need to check the emft sources and reproduce the solution for your plug
in, just like I did.

Perhaps we are lucky and Jacques Lescot will explain us what he did, and
why.

In https://bugs.eclipse.org/bugs/show_bug.cgi?id=206778 is an other
integration solution I did not tried out. You could patch the gmf
source, provided by Enrico Schnepel.

I hope this will help.

You could vote for this bug. :)

greetings, urs.

--------------090802030103030909040604
Content-Type: text/x-java;
name="CallchainNavigator.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="CallchainNavigator.java"

/**
*
*/
package de.urszeidler.eclipse.callchain.diagram.outline;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavi gator;
import org.eclipse.gmf.runtime.diagram.ui.outline.IOutlineMenuConst ants;
import org.eclipse.gmf.runtime.diagram.ui.outline.actions.CreateDia gramAction;
import org.eclipse.gmf.runtime.diagram.ui.outline.actions.DeleteDia gramAction;
import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPa rt;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.IPageSite;

import de.urszeidler.eclipse.callchain.Calls;
import de.urszeidler.eclipse.callchain.diagram.edit.parts.CallsEdit Part;
import de.urszeidler.eclipse.callchain.diagram.part.CallchainDiagra mEditorPlugin;

/**
* @author urs
*
*/
public class CallchainNavigator extends AbstractModelNavigator {

public CallchainNavigator(Composite parent,
IDiagramWorkbenchPart diagEditor, IPageSite pageSite) {
super(parent, diagEditor, pageSite);
}

/* (non-Javadoc)
* @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavi gator#getAdapterFactory()
*/
@Override
protected AdapterFactory getAdapterFactory() {
return CallchainDiagramEditorPlugin.getInstance().getItemProvidersA dapterFactory();
}

/**
* @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavi gator#createDiagramsMenu(org.eclipse.jface.action.IMenuManag er,
* org.eclipse.emf.ecore.EObject)
*/
@Override
protected void createDiagramsMenu(IMenuManager manager, EObject selectedObject) {
super.createDiagramsMenu(manager, selectedObject);

if (selectedObject instanceof Calls) {
final EObject selectedObj = selectedObject;
manager.appendToGroup(IOutlineMenuConstants.NEW_GROUP, new CreateDiagramAction(selectedObject, getDiagramResource(), CallsEditPart.MODEL_ID,
CallchainDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
//final
// manager.appendToGroup(IOutlineMenuConstants.NEW_GROUP, new CreateDiagramAction(selectedObject, getDiagramResource(), CallsEditPart.MODEL_ID,
// CallchainDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT){
// /**
// * This methods creates a new Diagram to be associated with the given domain
// * element
// *
// * @see org.eclipse.jface.action.Action#run()
// */
// public void run() {
// InputDialog dialog = new InputDialog(Activator.getDefault().getWorkbench().getDisplay ().getActiveShell(), "Create new Diagram", "Diagram name : ", "diagram", null);
// if (dialog.open() == Window.OK) {
// String name = dialog.getValue();
// if (name != null && !name.equals("")) {
// Diagram d = ViewService.createDiagram(selectedObj, CallsEditPart.MODEL_ID,
// CallchainDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
// d.setName(name);
// // TODO if we want to initialize diagram contents, the action
// // should be moved into the appropriate editor plugin. No
// // generic method here
// // new EcoreDiagramContentInitializer().initDiagramContent(d);
//
// TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getDiagramResource());
// AddCommand addcmd = new AddCommand(editingDomain, getDiagramResource().getContents(), d);
// editingDomain.getCommandStack().execute(addcmd);
// try {
// getDiagramResource().save(getDiagramResource().getResourceSe t().getLoadOptions());
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// Collection<?> collection = addcmd.getCollection();
// }
// }
// }
//
//
// });
}
if (selectedObject instanceof Diagram) {
// Check that this is not the current diagram
if (getEditor().getDiagram() != selectedObject) {
manager.appendToGroup(IOutlineMenuConstants.NEW_GROUP, new DeleteDiagramAction((Diagram) selectedObject));
}
}
}

protected void initDragAndDrop() {
super.initDragAndDrop();
}

protected void createEMFMenu(IMenuManager manager, EObject selectedObject) {

if (!isEMFMenuEnabledFor(selectedObject)) {

return;
}
//
// // TODO Restore this
// MixedEditDomain domain = (MixedEditDomain) modeler
// .getAdapter(MixedEditDomain.class);
//
// if (domain != null) {
// IPreferenceStore ps = modeler.getPreferenceStore();
// if (ps != null) {
// String id = ps
// .getString(ModelerPreferenceConstants.CREATE_CHILD_MENU_PREF );
// CreateChildMenuConfiguration config = OutlineManager
// .getInstance().getCreateChildMenuConfiguration(id);
// ICreateChildMenu createChildMenu = null;
// if (config != null) {
// createChildMenu = config.getMenu();
// }
// if (createChildMenu == null) {
// createChildMenu = new DefaultCreateChildMenu();
// }
//
// createChildMenu.removeAll();
// createChildMenu.setMixedEditDomain(domain);
// createChildMenu.setSelectedEObject(selectedObject);
// createChildMenu.createMenuContents();
//
// manager.appendToGroup(IOutlineMenuConstants.NEW_GROUP,
// createChildMenu);
// }
// }
}

}

--------------090802030103030909040604
Content-Type: text/x-java;
name="CallChainDiagramOutlinePage.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="CallChainDiagramOutlinePage.java"

package de.urszeidler.eclipse.callchain.diagram.outline;

import org.eclipse.gmf.runtime.diagram.ui.outline.AbstractDiagramsO utlinePage;
import org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavi gator;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.IPageSite;

import de.urszeidler.eclipse.callchain.diagram.part.CallchainDiagra mEditor;
import de.urszeidler.eclipse.callchain.diagram.part.CallchainDiagra mEditorPlugin;

public class CallChainDiagramOutlinePage extends AbstractDiagramsOutlinePage {
public CallChainDiagramOutlinePage(DiagramEditor editor) {
super(editor);
}


/**
* @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractDiagramsO utlinePage#createNavigator(org.eclipse.swt.widgets.Composite ,
* org.eclipse.ui.part.IPageSite)
*/
@Override
protected AbstractModelNavigator createNavigator(Composite parent, IPageSite pageSite) {
return new CallchainNavigator(parent, getEditor(), pageSite);
}

/**
* @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractDiagramsO utlinePage#getPreferenceStore()
*/
@Override
protected IPreferenceStore getPreferenceStore() {
return CallchainDiagramEditorPlugin.getInstance().getPreferenceStor e();
}

/**
* @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractDiagramsO utlinePage#getEditorID()
*/
@Override
protected String getEditorID() {
return CallchainDiagramEditor.ID;
}


}

--------------090802030103030909040604--
Re: Integration between Graphical editor and outline view [message #191556 is a reply to message #191547] Sat, 07 June 2008 14:01 Go to previous messageGo to next message
gaurav dubey is currently offline gaurav dubeyFriend
Messages: 45
Registered: July 2009
Member
hi zeidler,
Thanks for the reply, it really help me a lot. Now i am able to
show tree view in outline, now i want to add a menu in the tree for
deleting the widget from graphics editor. Cause when i delete a widget
from diagram editor the tree item removes but from outline view deletion
is not working. Can u give me some idea about how to delete a widget from
graphics editor when i select a tree item and press the delete key.


Thanks in advance.

Regards
gaurav
Re: Integration between Graphical editor and outline view [message #191570 is a reply to message #191556] Sun, 08 June 2008 02:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.urszeidler.de

Gaurav dubey wrote:
> hi zeidler,
> Thanks for the reply, it really help me a lot. Now i am able to
> show tree view in outline, now i want to add a menu in the tree for
> deleting the widget from graphics editor. Cause when i delete a widget
> from diagram editor the tree item removes but from outline view deletion
> is not working. Can u give me some idea about how to delete a widget
> from graphics editor when i select a tree item and press the delete key.
>
>
> Thanks in advance.
>
> Regards
> gaurav
>
>
You can do something like this in xxxNavigator :

protected void createEMFMenu(IMenuManager manager, EObject
selectedObject) {

if (!isEMFMenuEnabledFor(selectedObject)) {


return;
}

TransactionalEditingDomain editingDomain =
TransactionUtil.getEditingDomain(getDiagramResource());

IStructuredSelection structuredSelection= new
StructuredSelection(selectedObject);
DeleteAction deleteAction = new DeleteAction(editingDomain);
deleteAction.updateSelection(structuredSelection);
manager.add(new ActionContributionItem(deleteAction));

....

greetings urs.
Re: Integration between Graphical editor and outline view [message #191695 is a reply to message #191570] Mon, 09 June 2008 12:14 Go to previous messageGo to next message
gaurav dubey is currently offline gaurav dubeyFriend
Messages: 45
Registered: July 2009
Member
Thanks for the help,
Now my outline view is fully functional and it has
all functionality what i want, but i have a problem in this outline view i
am not able to find where the tree items are added in the outline tree
cause i want to change the image displayed in that tree and add another
column for put some additional information in tree node.
Is this a part of Editor or i have to change in outline view.

And another question is that i want that in outline view additional
resources and diagram tree items are not shown. Can i dispose them, Cause
when i am doing this outline view is not opened.

waiting for reply

Thanks in advance
Re: Integration between Graphical editor and outline view [message #192073 is a reply to message #191695] Wed, 11 June 2008 10:40 Go to previous messageGo to next message
urs zeidler is currently offline urs zeidlerFriend
Messages: 91
Registered: July 2009
Member
gaurav bhargav schrieb:
> Thanks for the help,
> Now my outline view is fully functional and it has
> all functionality what i want, but i have a problem in this outline view
> i am not able to find where the tree items are added in the outline tree
> cause i want to change the image displayed in that tree and add another
> column for put some additional information in tree node. Is this a part
> of Editor or i have to change in outline view.
>
This would be done with the XXXItemProvider in the xxx.edit plugin.
Pure EMF.

> And another question is that i want that in outline view additional
> resources and diagram tree items are not shown. Can i dispose them,
> Cause when i am doing this outline view is not opened.
>
This could achieved by overriding initProviders() in your xxxNavigator,
take a look at the AbstractModelNavigator to get a clue. In short you
will need to change the contentprovider for the tree viewer.

greetings, urs.
Re: Integration between Graphical editor and outline view [message #192112 is a reply to message #192073] Wed, 11 June 2008 14:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

hi,
But when i change the image in provider class the image change in
pallet and gmf figure also, what i want is i create 2 column in tree and i
want to show difference images in both the column. i try this but it
doesn't work it always take same image in both columns. How can i achieve
this.


Thanks in advance

Regards
Gaurav
Re: Integration between Graphical editor and outline view [message #192241 is a reply to message #192112] Thu, 12 June 2008 08:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

hi all,

i solve this problem by changing in doupdatelement() method.

Thanks for guidance.
Re: Integration between Graphical editor and outline view [message #192253 is a reply to message #192241] Thu, 12 June 2008 10:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

hello zeidler,

Thanks for your support,Now my outline view is complete but
i am not able to add the support of drag and drop in outline tree
viewer.The normal dnd functioning doesn't work with outline tree viewer.
Please give me idea about how to implement drag and drop in outline tree
viewer.


Thanks in advance.

regards
Gaurav Bhargav
Re: Integration between Graphical editor and outline view [message #192347 is a reply to message #192253] Thu, 12 June 2008 23:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.urszeidler.de

This is a multi-part message in MIME format.
--------------030309010008070200020300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

I think GMF 2.1 will support this by generation.
To get this to working 2.01 I looked in the emft sources and did the
following :

in xxxDiagramEditor
> /**
> * @generated NOT
> */
> protected void initializeGraphicalViewer() {
> super.initializeGraphicalViewer();
>> getDiagramGraphicalViewer().addDropTargetListener(
>> new DiagramDropTargetListener(getDiagramGraphicalViewer(),
>> LocalSelectionTransfer.getTransfer()) {
>>
>> protected Object getJavaObject(TransferData data) {
>> return LocalSelectionTransfer.getTransfer()
>> .nativeToJava(data);
>> }
>>
>> @Override
>> protected List getObjectsBeingDropped() {
>> /* Get the selection from the transfer agent */
>> List fileList = new ArrayList();
>>
>> fileList.add(LocalSelectionTransfer.getTransfer()
>> .getSelection());
>>
>> if (fileList.size() > 0)
>> return fileList;
>>
>> return null;
>> }
>>
>> });
> }


Creates a dndeditpolicy(attachment example) and install it in in your
diagram editpart :

> /**
> * @generated not
> */
> protected void createDefaultEditPolicies() {
> super.createDefaultEditPolicies();
> installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
> new CallsItemSemanticEditPolicy());
> // installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
> // new CallsCanonicalEditPolicy());
> // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpoli cies.EditPolicyRoles.POPUPBAR_ROLE);
> installEditPolicy(CallChainEditPolicyRoles.PSEUDO_CANONICAL_ ROLE,
> new CallsCanonicalEditPolicy());
>> installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
>> new CallsDiagramDragDropEditPolicy());
> }


greetings, urs.

--------------030309010008070200020300
Content-Type: text/x-java;
name="CallsDiagramDragDropEditPolicy.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="CallsDiagramDragDropEditPolicy.java"

/*********************************************************** ************
* Copyright (c) 2007 Anyware Technologies
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Anyware Technologies - initial API and implementation
************************************************************ **********/

package de.urszeidler.eclipse.callchain.diagram.edit.policies;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.core.preferences.Preferences Hint;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditP art;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragD ropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewReques t;
import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsReque st;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.StructuredSelection;

import de.urszeidler.eclipse.callchain.diagram.edit.commands.Update EditPartCommand;
import de.urszeidler.eclipse.callchain.diagram.part.CallchainDiagra mEditorPlugin;

public class CallsDiagramDragDropEditPolicy extends DiagramDragDropEditPolicy {

public Command getDropObjectsCommand(DropObjectsRequest dropRequest) {
List shortcutViewDescriptors = new ArrayList();
List normalViewDescriptors = new ArrayList();
for (Iterator it = dropRequest.getObjects().iterator(); it.hasNext();) {
Object nextObject = it.next();
if (nextObject instanceof StructuredSelection) {
StructuredSelection se = (StructuredSelection) nextObject;

for (Iterator iterator = se.iterator(); iterator
.hasNext();) {
Object object = (Object) iterator.next();
processObjects(object, dropRequest, normalViewDescriptors, shortcutViewDescriptors);
}
}else
processObjects(nextObject, dropRequest, normalViewDescriptors, shortcutViewDescriptors);

// if (false == nextObject instanceof EObject) {
// continue;
// }
//
// // Continue if element is the diagram canvas
// if (getView().getElement().equals(nextObject)) {
// continue;
// }
//
// // Continue if element already in diagram
// if (false == isElementInView(nextObject, dropRequest) && getView().getElement() == ((EObject) nextObject).eContainer()) {
// normalViewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter((EObject) nextObject), Node.class, null, getDiagramPreferencesHint()));
// } else {
// shortcutViewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter((EObject) nextObject), Node.class, null, getDiagramPreferencesHint()));
// }
}

Command shortcutCommand = null;
if (false == shortcutViewDescriptors.isEmpty()) {
shortcutCommand = createShortcutsCommand(dropRequest, shortcutViewDescriptors);
}
Command normalCommand = null;
if (false == normalViewDescriptors.isEmpty()) {
normalCommand = createNormalViewCommand(dropRequest, normalViewDescriptors);
}
if (shortcutCommand != null) {
Command createBoth = shortcutCommand.chain(normalCommand);
return createBoth.chain(new ICommandProxy(new UpdateEditPartCommand(getEditingDomain(), getHost())));
}
if (normalCommand != null) {
return normalCommand.chain(new ICommandProxy(new UpdateEditPartCommand(getEditingDomain(), getHost())));
}
return UnexecutableCommand.INSTANCE;
}

private void processObjects(Object object, Request dropRequest, List normalViewDescriptors, List shortcutViewDescriptors){
if (false == object instanceof EObject) {
return;
}

// Continue if element is the diagram canvas
if (getView().getElement().equals(object)) {
return;
}

// Continue if element already in diagram
if (false == isElementInView(object, dropRequest) && getView().getElement() == ((EObject) object).eContainer()) {
normalViewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter((EObject) object), Node.class, null, getDiagramPreferencesHint()));
} else {
shortcutViewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter((EObject) object), Node.class, null, getDiagramPreferencesHint()));
}

}

protected boolean isElementInView(Object nextObject, Request request) {
for (Iterator it = getView().getChildren().iterator(); it.hasNext();) {
View nextView = (View) it.next();
if (nextView.getEAnnotation("Shortcut") != null) {
continue;
}
if (nextView.getElement() == null) {
continue;
}
if (nextView.getElement().equals(nextObject)) {
return true;
}
}
return false;
}

private Command createShortcutsCommand(DropObjectsRequest dropRequest, List viewDescriptors) {
Command command = createViews(dropRequest, viewDescriptors);
if (command != null) {
//return command.chain(new ICommandProxy(new EcoreCreateShortcutDecorationsCommand(getEditingDomain(), getView(), viewDescriptors)));
}
return null;
}

private Command createNormalViewCommand(DropObjectsRequest dropRequest, List viewDescriptors) {
return createViews(dropRequest, viewDescriptors);
}

protected Command createViews(DropObjectsRequest dropRequest, List viewDescriptors) {
CreateViewRequest createViewRequest = new CreateViewRequest(viewDescriptors);
createViewRequest.setLocation(dropRequest.getLocation());
Command createCommand = getHost().getCommand(createViewRequest);

return createCommand;
}

private TransactionalEditingDomain getEditingDomain() {
if (getHost() instanceof IGraphicalEditPart) {
return ((IGraphicalEditPart) getHost()).getEditingDomain();
}
return null;
}

protected View getView() {
return (View) getHost().getModel();
}

protected PreferencesHint getDiagramPreferencesHint() {
return CallchainDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
}
}

--------------030309010008070200020300--
Re: Integration between Graphical editor and outline view [message #192354 is a reply to message #192347] Fri, 13 June 2008 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

hi zeidler,
I make these changes in code, but nothing is happen,What i want
is when i select a tree item in outline viewer and drop over another tree
item then the source tree item is added as child of target tree item and
it will also reflect on Diagram editor means the source widget becomes
overlap the target item.
Currently the normal tree drag and drop not works for me, I think you
provided me the code for drag and drop in editor, it works in graphics
editor but never reflects in outline viewer.What i want is if i drag a
widget over another widget then in tree viewer the tree item corresponding
widget becomes child of target widget tree item.

Please guide me.


Thanks in advance.

regards
Gaurav Bhargav
Re: Integration between Graphical editor and outline view [message #192396 is a reply to message #192354] Fri, 13 June 2008 09:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

hi zeidler,

I make some changes in AbstractModelNavigator class for support of drag
and drop, The code is given below,

//operations
int ops = DND.DROP_MOVE | DND.DROP_LINK |DND.DROP_TARGET_MOVE;

org.eclipse.swt.dnd.Transfer[] transfers = new
org.eclipse.swt.dnd.Transfer[] {LocalTransfer.getInstance()};
viewer.addDragSupport(ops, transfers, new
ViewerDragAdapter(viewer));
viewer.addDropSupport(ops, transfers, new

EditingDomainViewerDropAdapter(editor.getDiagramEditPart().g etEditingDomain(),
viewer));


but using this code only tree item's position is change, but the drag over
operation is not working means when i drag a tree item over another tree
item the source tree item will be child of target tree item but it doesn't
work in outline tree viewer(as in normal tree viewer it works ),

Can you provide me some guidance that how it will work in outline tree
viewer.
Re: Integration between Graphical editor and outline view [message #192688 is a reply to message #192396] Sun, 15 June 2008 07:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.urszeidler.de

gaurav bhargav wrote:
> hi zeidler,
>
> I make some changes in AbstractModelNavigator class for support of drag
> and drop, The code is given below,
>
> //operations
> int ops = DND.DROP_MOVE | DND.DROP_LINK |DND.DROP_TARGET_MOVE;
>
> org.eclipse.swt.dnd.Transfer[] transfers = new
> org.eclipse.swt.dnd.Transfer[] {LocalTransfer.getInstance()};
> viewer.addDragSupport(ops, transfers, new
> ViewerDragAdapter(viewer));
> viewer.addDropSupport(ops, transfers, new
>
> EditingDomainViewerDropAdapter(editor.getDiagramEditPart().g etEditingDomain(),
> viewer));
>
>
> but using this code only tree item's position is change, but the drag
> over operation is not working means when i drag a tree item over another
> tree item the source tree item will be child of target tree item but it
> doesn't work in outline tree viewer(as in normal tree viewer it works ),
>
> Can you provide me some guidance that how it will work in outline tree
> viewer.
>
>
>
My code snippet was only about dragging from the outline in the diagram
editor.

I'm afraid I do not know this, and I have no own use case for the moment
to investigate it. So I would suggest you look in your generated emf
Editor plugin, I think this is an EMF question, perhaps you ask in the
EMF newsgroup, the man who knows will answer. (Ed)


greetings, urs.
Re: Integration between Graphical editor and outline view [message #193177 is a reply to message #192688] Wed, 18 June 2008 06:54 Go to previous message
Eclipse UserFriend
Originally posted by: gaurav_tas.rediffmail.com

Hello zeidler ,
In outline ttee view when i select a treeitem, corresponding widget is
selected but what i want is when i select a widget corresponding treeitem
also selected,which is not working now.
is it possible if yes how can i do this.

Please suggest me.

Thanks in advance
gaurav bhargav
Previous Topic:Pen tool to sketch
Next Topic:Alignment and Offsets of Labels
Goto Forum:
  


Current Time: Sat Apr 27 02:51:55 GMT 2024

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

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

Back to the top