/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
*
* 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:
* Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.communication.custom.parser;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.papyrus.uml.diagram.communication.custom.messages.Messages;
import org.eclipse.uml2.uml.Message;
// TODO: Auto-generated Javadoc
/**
* The Class MessageParser.
*/
public class MessageParser implements IParser {
/*
* (non-Javadoc)
*
* @see org.eclipse.gmf.runtime.common.ui.services.parser.IParser#getEditString(org.eclipse.core.runtime.IAdaptable, int)
*/
public String getEditString(IAdaptable element, int flags) {
// TODO Auto-generated method stub
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gmf.runtime.common.ui.services.parser.IParser#isValidEditString(org.eclipse.core.runtime.IAdaptable, java.lang.String)
*/
public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
// TODO Auto-generated method stub
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gmf.runtime.common.ui.services.parser.IParser#getParseCommand(org.eclipse.core.runtime.IAdaptable, java.lang.String, int)
*/
public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
// TODO Auto-generated method stub
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gmf.runtime.common.ui.services.parser.IParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int)
*/
public String getPrintString(IAdaptable element, int flags) {
if(element instanceof EObjectAdapter) {
String result = ""; //$NON-NLS-1$
final Message message = ((Message)((EObjectAdapter)element).getRealObject());
if(message == null) {
return Messages.MessageParser_undefined;
}
if(message.getEAnnotations() != null) {
// EList<EAnnotation> an = message.getEAnnotations();
/*
* if (an.isEmpty())
* System.out.print("List is empty");
*/
// if ( message.getEAnnotations().get(0) != null)
// result =
// message.getEAnnotations().get(0).getDetails().get(0).getValue()
// + ":" + message.getName();
// else
result = message.getName();
} else
result = message.getName();
// result = "1:" + result;
return result;
}
return Messages.MessageParser_undefined;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gmf.runtime.common.ui.services.parser.IParser#isAffectingEvent(java.lang.Object, int)
*/
public boolean isAffectingEvent(Object event, int flags) {
// TODO Auto-generated method stub
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gmf.runtime.common.ui.services.parser.IParser#getCompletionProcessor(org.eclipse.core.runtime.IAdaptable)
*/
public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
// TODO Auto-generated method stub
return null;
}
}