/******************************************************************************* | |
* Copyright (c) 2004-2008 Istvan Rath and Daniel Varro | |
* 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: | |
* Istvan Rath - initial API and implementation | |
*******************************************************************************/ | |
package org.eclipse.viatra2.treeeditor.providers; | |
import org.eclipse.viatra2.framework.properties.VIATRAPropertyKind; | |
import org.eclipse.viatra2.framework.properties.providers.DefaultPropertyProvider; | |
public class ViatraEditorPropertyProvider extends DefaultPropertyProvider | |
{ | |
public final static String VIATRA_EDITOR_PROVIDER_ID = "VIATRA2 Tree Editor"; | |
public final static String PROP_FORMATSTRING_ENTITY = "Format string for Entities"; | |
public final static String PROP_FORMATSTRING_RELATION = "Format string for Relations"; | |
public final static String PROP_FORMATSTRING_RELATION_TARGET = "Format string for Relation Targets"; | |
public final static String PROP_FORMATSTRING_RELATION_TARGET_SHOW = "Show 'to' relations at targets"; | |
public ViatraEditorPropertyProvider() { | |
super(VIATRA_EDITOR_PROVIDER_ID); | |
} | |
public boolean isActive() { | |
return true; | |
} | |
public String getDefaultPropertyValue(String id) { | |
if (id.equals(PROP_FORMATSTRING_ENTITY)) | |
{ | |
return "%n%[20]{ {$%}}v%{ : $}t%{ [$]}s"; | |
} | |
else if (id.equals(PROP_FORMATSTRING_RELATION)) | |
{ | |
return "%n (-> %target)%{ : $}t%{ [$]}s"; | |
} | |
else if (id.equals(PROP_FORMATSTRING_RELATION_TARGET)) | |
{ | |
return "(%source ->) %n %{ : $}t%{ [$]}s"; | |
} | |
else if (id.equals(PROP_FORMATSTRING_RELATION_TARGET_SHOW)) | |
return "true"; | |
return "default"; | |
} | |
@Override | |
public void init() { | |
allids.add(PROP_FORMATSTRING_ENTITY); | |
allids.add(PROP_FORMATSTRING_RELATION); | |
allids.add(PROP_FORMATSTRING_RELATION_TARGET); | |
allids.add(PROP_FORMATSTRING_RELATION_TARGET_SHOW); | |
} | |
public VIATRAPropertyKind getPropertyKind(String id) { | |
if (id.equals(PROP_FORMATSTRING_RELATION_TARGET_SHOW)) | |
return VIATRAPropertyKind.BOOLEAN; | |
return VIATRAPropertyKind.STRING; | |
} | |
} | |