Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
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 $Id: EcoreCreateShortcutDecorationsCommand.java,v 1.3 2009/02/02 08:39:07 jlescot Exp $ /
package org.eclipse.emf.ecoretools.diagram.edit.commands;
import  org.eclipse.core.runtime.IAdaptable;
import  org.eclipse.core.runtime.IProgressMonitor;
import  org.eclipse.gmf.runtime.common.core.command.CommandResult;
import  org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import  org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import  org.eclipse.gmf.runtime.notation.View;

Generated:
public class EcoreCreateShortcutDecorationsCommand extends AbstractTransactionalCommand {

Generated:
	private List myDescriptors;

Generated:
	public EcoreCreateShortcutDecorationsCommand(TransactionalEditingDomain editingDomain, View parentViewList viewDescriptors) {
		super(editingDomain"Create Shortcuts", getWorkspaceFiles(parentView)); //$NON-NLS-1$
		 = viewDescriptors;
	}

Generated:
	public EcoreCreateShortcutDecorationsCommand(TransactionalEditingDomain editingDomain, View parentView, CreateViewRequest.ViewDescriptor viewDescriptor) {
		this(editingDomainparentView, Collections.singletonList(viewDescriptor));
	}

Generated:
	protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable infothrows ExecutionException {
		for (Iterator it = .iterator(); it.hasNext();) {
			CreateViewRequest.ViewDescriptor nextDescriptor = (CreateViewRequest.ViewDescriptor) it.next();
			View view = (View) nextDescriptor.getAdapter(View.class);
			if (view != null && view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
				shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
				shortcutAnnotation.getDetails().put("modelID".); //$NON-NLS-1$
				view.getEAnnotations().add(shortcutAnnotation);
			}
		}
		return CommandResult.newOKCommandResult();
	}
New to GrepCode? Check out our FAQ X