Skip to content

Commit

Permalink
added trainings times
Browse files Browse the repository at this point in the history
  • Loading branch information
UrsZeidler committed Apr 6, 2015
1 parent 0a23d23 commit 76a43bf
Show file tree
Hide file tree
Showing 26 changed files with 130 additions and 47 deletions.
7 changes: 7 additions & 0 deletions de.urszeidler.shr5.ecp/shr5Resource/shr5-1.shr5
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@
</entries>
<entries xsi:type="shr5mngt:CharacterAdvancementSystem" xmi:id="_BtZ9QN0CEeOvVYoRsPZlnA" name="The basic advancements system.">
<characterAdvancements xsi:type="shr5mngt:IncreaseCharacterPart" xmi:id="_BtakUN0CEeOvVYoRsPZlnA" karmaFactor="5">
<rangeTableEntries xsi:type="shr5mngt:TrainingRate" xmi:id="_Q1xGYNxREeSIu9nfJbIinQ" factor="2" timeUnit="week"/>
<type href="http://urszeidler.de/shr5/1.0#//FertigkeitsGruppe"/>
</characterAdvancements>
<characterAdvancements xsi:type="shr5mngt:IncreaseCharacterPart" xmi:id="_BtakUd0CEeOvVYoRsPZlnA" karmaFactor="2">
<rangeTableEntries xsi:type="shr5mngt:TrainingRate" xmi:id="_2dZrgNxQEeSIu9nfJbIinQ" from="1" to="4" factor="1" timeUnit="day"/>
<rangeTableEntries xsi:type="shr5mngt:TrainingRate" xmi:id="_7VhRANxQEeSIu9nfJbIinQ" from="5" to="8" factor="1" timeUnit="week"/>
<rangeTableEntries xsi:type="shr5mngt:TrainingRate" xmi:id="__mk2gNxQEeSIu9nfJbIinQ" from="9" to="13" factor="2" timeUnit="week"/>
<type href="http://urszeidler.de/shr5/1.0#//Fertigkeit"/>
</characterAdvancements>
<characterAdvancements xsi:type="shr5mngt:IncreaseCharacterPart" xmi:id="_BtakUt0CEeOvVYoRsPZlnA" karmaFactor="1">
Expand All @@ -133,6 +137,7 @@
<type href="http://urszeidler.de/shr5/1.0#//Sprachfertigkeit"/>
</characterAdvancements>
<characterAdvancements xsi:type="shr5mngt:IncreaseCharacterPart" xmi:id="_BtbLYd0CEeOvVYoRsPZlnA" karmaFactor="7">
<rangeTableEntries xsi:type="shr5mngt:TrainingRate" xmi:id="_oL6GYNxREeSIu9nfJbIinQ" factor="1" timeUnit="month"/>
<type href="http://urszeidler.de/shr5/1.0#//Spezialisierung"/>
</characterAdvancements>
<characterAdvancements xsi:type="shr5mngt:IncreaseCharacterPart" xmi:id="_BtbLYt0CEeOvVYoRsPZlnA" karmaFactor="5">
Expand All @@ -142,6 +147,7 @@
<type href="http://urszeidler.de/shr5/1.0#//PersonaKomplexForm"/>
</characterAdvancements>
<characterAdvancements xsi:type="shr5mngt:IncreaseCharacterPart" xmi:id="_BtbLZN0CEeOvVYoRsPZlnA" karmaFactor="5">
<rangeTableEntries xsi:type="shr5mngt:TrainingRate" xmi:id="_h_PJwNxGEeSbUbUh3ZbU7A" factor="1" timeUnit="week"/>
<type href="http://www.eclipse.org/emf/2002/Ecore#//EAttribute"/>
</characterAdvancements>
<characterAdvancements xsi:type="shr5mngt:IncreaseCharacterPart" xmi:id="_BtbycN0CEeOvVYoRsPZlnA" karmaFactor="2">
Expand Down Expand Up @@ -1213,6 +1219,7 @@
<lifestyleToStartMoney xmi:id="_Ul4LEckCEeSkAbRNCR2heA" numberOfW="5" moneyFactor="500" lifeStyles="619be8b8-52a0-46b0-9566-a4102bd2040a"/>
<lifestyleToStartMoney xmi:id="_Ul4yIMkCEeSkAbRNCR2heA" numberOfW="6" moneyFactor="1000" lifeStyles="ebb68d2c-a882-4356-8031-2f62d3f6d064"/>
<additionalConstrains xmi:id="_-q1fcNwuEeSfsbuIbqNZtw" source="_lcQegNwrEeSfsbuIbqNZtw" targets="_XK5WoNCDEeSX5PKgPhCdqw" constrainType="needOneOf"/>
<additionalConstrains xmi:id="_pZN68Nw5EeSjYfcbQw6yWA" source="_4wLJwNwsEeSfsbuIbqNZtw" targets="_XK5WoNCDEeSX5PKgPhCdqw" constrainType="needOneOf"/>
<priorities xsi:type="shr5mngt:MetaType" xmi:id="_8RGg9bL6EeS74JF_046f_w" choosableTypes="a53d885d-a4a4-443d-b6a6-b0a55b0a96c7"/>
<priorities xsi:type="shr5mngt:MetaType" xmi:id="_8RGg9rL6EeS74JF_046f_w" cost="40" choosableTypes="b3259991-b315-4dbe-ae3c-51f71a1116e2"/>
<priorities xsi:type="shr5mngt:MetaType" xmi:id="_8RGg97L6EeS74JF_046f_w" cost="50" choosableTypes="08f2c9cc-f9f8-4f1a-9efb-63555af71788"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@
import de.urszeidler.eclipse.shr5.Wurfwaffe;
import de.urszeidler.eclipse.shr5.Zauber;
import de.urszeidler.eclipse.shr5.util.Shr5Switch;
import de.urszeidler.eclipse.shr5Management.CharacterAdvancementSystem;
import de.urszeidler.eclipse.shr5Management.CharacterGenerator;
import de.urszeidler.eclipse.shr5Management.CharacterGroup;
import de.urszeidler.eclipse.shr5Management.FreeStyleGenerator;
import de.urszeidler.eclipse.shr5Management.GamemasterManagement;
import de.urszeidler.eclipse.shr5Management.GeneratorState;
import de.urszeidler.eclipse.shr5Management.GruntGroup;
import de.urszeidler.eclipse.shr5Management.IncreaseCharacterPart;
import de.urszeidler.eclipse.shr5Management.LifeModule;
import de.urszeidler.eclipse.shr5Management.LifeModulesGenerator;
import de.urszeidler.eclipse.shr5Management.ManagedCharacter;
Expand All @@ -64,10 +66,12 @@
import de.urszeidler.eclipse.shr5Management.Shr5managementFactory;
import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;
import de.urszeidler.eclipse.shr5Management.SumToTenGenerator;
import de.urszeidler.eclipse.shr5Management.TrainingRate;
import de.urszeidler.eclipse.shr5Management.util.Shr5managementSwitch;
import de.urszeidler.shr5.ecp.editor.pages.BeschreibbarContainterPage;
import de.urszeidler.shr5.ecp.editor.pages.ContractPage;
import de.urszeidler.shr5.ecp.editor.pages.DefaultEmfFormsPage;
import de.urszeidler.shr5.ecp.editor.pages.EObjectBasicPage;
import de.urszeidler.shr5.ecp.editor.pages.FernkampfwaffePage;
import de.urszeidler.shr5.ecp.editor.pages.FertigkeitPage;
import de.urszeidler.shr5.ecp.editor.pages.FeuerwaffePage;
Expand All @@ -77,7 +81,6 @@
import de.urszeidler.shr5.ecp.editor.pages.Messages;
import de.urszeidler.shr5.ecp.editor.pages.ModifikatorPage;
import de.urszeidler.shr5.ecp.editor.pages.ModifizierbarPage;
import de.urszeidler.shr5.ecp.editor.pages.ModuleChangePage;
import de.urszeidler.shr5.ecp.editor.pages.PrintPreviewPage;
import de.urszeidler.shr5.ecp.editor.pages.ReichweitePage;
import de.urszeidler.shr5.ecp.editor.pages.SoftwarePage;
Expand Down Expand Up @@ -674,7 +677,7 @@ public Object caseShr5System(Shr5System object) {
return this;
}

@SuppressWarnings("rawtypes")
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object caseCharacterGenerator(CharacterGenerator object) {

Expand Down Expand Up @@ -715,22 +718,53 @@ public Object caseLifeModule(LifeModule object) {
@Override
public Object caseModuleChange(ModuleChange object) {
try {
addPage(new ModuleChangePage(ShadowrunEditor.this, EMPTY, labelProvider.getText(object.eClass()), object, editingDomain, manager));
addPage(new EObjectBasicPage(ShadowrunEditor.this, EMPTY, labelProvider.getText(object.eClass()), object, editingDomain, manager));
} catch (PartInitException e) {
logError("error creating VariousItemsPage", e);//$NON-NLS-1$
logError("error creating EObjectBasicPage", e);//$NON-NLS-1$
}
return super.caseModuleChange(object);
}

@Override
public Object caseQuellenConstrain(QuellenConstrain object) {
try {
addPage(new ModuleChangePage(ShadowrunEditor.this, EMPTY, labelProvider.getText(object.eClass()), object, editingDomain, manager));
addPage(new EObjectBasicPage(ShadowrunEditor.this, EMPTY, labelProvider.getText(object.eClass()), object, editingDomain, manager));
} catch (PartInitException e) {
logError("error creating VariousItemsPage", e);//$NON-NLS-1$
logError("error creating EObjectBasicPage", e);//$NON-NLS-1$
}
return super.caseQuellenConstrain(object);
}

@Override
public Object caseIncreaseCharacterPart(IncreaseCharacterPart object) {
try {
addPage(new EObjectBasicPage(ShadowrunEditor.this, EMPTY, labelProvider.getText(object.eClass()), object, editingDomain, manager));
} catch (PartInitException e) {
logError("error creating EObjectBasicPage", e);//$NON-NLS-1$
}
return super.caseIncreaseCharacterPart(object);
}

@Override
public Object caseTrainingRate(TrainingRate object) {
try {
addPage(new EObjectBasicPage(ShadowrunEditor.this, EMPTY, labelProvider.getText(object.eClass()), object, editingDomain, manager));
} catch (PartInitException e) {
logError("error creating EObjectBasicPage", e);//$NON-NLS-1$
}
return super.caseTrainingRate(object);
}

@Override
public Object caseCharacterAdvancementSystem(CharacterAdvancementSystem object) {
try {
addPage(new BeschreibbarContainterPage(ShadowrunEditor.this, EMPTY, labelProvider.getText(object.eClass()), object,
editingDomain, manager, Shr5managementPackage.Literals.CHARACTER_ADVANCEMENT_SYSTEM__CHARACTER_ADVANCEMENTS));
} catch (PartInitException e) {
logError("error creating BeschreibbarContainterPage", e);//$NON-NLS-1$
}
return this;
}
};
shr5managementSwitch.doSwitch(theEObject);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;

import de.urszeidler.eclipse.shr5.util.AdapterFactoryUtil;
import de.urszeidler.eclipse.shr5Management.IncreaseCharacterPart;
import de.urszeidler.eclipse.shr5Management.ModuleAttributeChange;
import de.urszeidler.eclipse.shr5Management.ModuleFeatureChange;
import de.urszeidler.eclipse.shr5Management.ModuleSkillChange;
import de.urszeidler.eclipse.shr5Management.ModuleSkillGroupChange;
import de.urszeidler.eclipse.shr5Management.ModuleTeachableChange;
import de.urszeidler.eclipse.shr5Management.QuellenConstrain;
import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;
import de.urszeidler.eclipse.shr5Management.TrainingRate;
import de.urszeidler.emf.commons.ui.util.EmfFormBuilder.ReferenceManager;
import de.urszeidler.shr5.ecp.util.ShadowrunEditingTools;

public class ModuleChangePage extends AbstractShr5Page<EObject> {
public class EObjectBasicPage extends AbstractShr5Page<EObject> {
private EObject object;
private EditingDomain editingDomain;

Expand All @@ -36,7 +38,7 @@ public class ModuleChangePage extends AbstractShr5Page<EObject> {
* @param id
* @param title
*/
public ModuleChangePage(String id, String title) {
public EObjectBasicPage(String id, String title) {
super(id, title);
}

Expand All @@ -50,17 +52,17 @@ public ModuleChangePage(String id, String title) {
* @wbp.eval.method.parameter id "Some id"
* @wbp.eval.method.parameter title "Some title"
*/
public ModuleChangePage(FormEditor editor, String id, String title) {
public EObjectBasicPage(FormEditor editor, String id, String title) {
super(editor, id, title);
}

public ModuleChangePage(FormEditor editor, String id, String title, EObject object) {
public EObjectBasicPage(FormEditor editor, String id, String title, EObject object) {
super(editor, id, title);
this.object = object;

}

public ModuleChangePage(FormEditor editor, String id, String title, EObject object, EditingDomain editingDomain, ReferenceManager manager) {
public EObjectBasicPage(FormEditor editor, String id, String title, EObject object, EditingDomain editingDomain, ReferenceManager manager) {
super(editor, id, title, manager);
this.object = object;
this.editingDomain = editingDomain;
Expand Down Expand Up @@ -116,6 +118,15 @@ protected void createFormContent(IManagedForm managedForm) {
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.QUELLEN_CONSTRAIN__SOURCE, composite);
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.QUELLEN_CONSTRAIN__CONSTRAIN_TYPE, composite);
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.QUELLEN_CONSTRAIN__TARGETS, composite);
} else if (object instanceof IncreaseCharacterPart) {
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.INCREASE_CHARACTER_PART__TYPE, composite);
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.ADVANCEMENT__KARMA_FACTOR, composite);
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.RANGE_TABLE__RANGE_TABLE_ENTRIES, composite);
}else if (object instanceof TrainingRate) {
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.RANGE_TABLE_ENTRY__FROM, composite);
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.RANGE_TABLE_ENTRY__TO, composite);
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.TRAINING_RATE__FACTOR, composite);
emfFormBuilder.addTextEntry(Shr5managementPackage.Literals.TRAINING_RATE__TIME_UNIT, composite);
}

emfFormBuilder.buildinComposite(m_bindingContext, managedForm.getForm().getBody(), object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;

import de.urszeidler.eclipse.shr5.BaseMagischePersona;
import de.urszeidler.eclipse.shr5.Shr5Package;
import de.urszeidler.eclipse.shr5.Technomancer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;

import org.eclipse.emf.edit.provider.ViewerNotification;

import de.urszeidler.eclipse.shr5.util.Shr5EditingTools;
import de.urszeidler.eclipse.shr5Management.IncreaseCharacterPart;
import de.urszeidler.eclipse.shr5Management.Shr5managementFactory;
import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;
Expand Down Expand Up @@ -119,12 +120,17 @@ public Object getImage(Object object) {
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @generated not
*/
@Override
public String getText(Object object) {
IncreaseCharacterPart increaseCharacterPart = (IncreaseCharacterPart)object;
return getString("_UI_IncreaseCharacterPart_type") + " " + increaseCharacterPart.getKarmaFactor();

final ComposeableAdapterFactory factory = ((Shr5managementItemProviderAdapterFactory)this.adapterFactory).getRootAdapterFactory();
final String unset = getString("_UI_Unset_text");
String labelForEObject = Shr5EditingTools.getLabelForEObject(factory, unset, increaseCharacterPart.getType());

return getString("_UI_IncreaseCharacterPart_type") + " [" +labelForEObject+"] cost: "+ increaseCharacterPart.getKarmaFactor();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

import de.urszeidler.eclipse.shr5Management.KarmaGaint;
import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

import de.urszeidler.eclipse.shr5Management.KarmaGenerator;
import de.urszeidler.eclipse.shr5Management.Shr5System;
import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;

import de.urszeidler.eclipse.shr5Management.ManagedCharacter;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;

import de.urszeidler.eclipse.shr5Management.PersonaChange;
import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EStructuralFeature;
Expand All @@ -13,6 +14,7 @@
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

import de.urszeidler.eclipse.shr5Management.ManagedCharacter;
import de.urszeidler.eclipse.shr5Management.PlayerCharacter;
import de.urszeidler.eclipse.shr5Management.Shr5managementFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
package de.urszeidler.eclipse.shr5Management.provider;


import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;
import de.urszeidler.eclipse.shr5Management.TrainingRate;

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
Expand All @@ -26,6 +21,9 @@
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;

import de.urszeidler.eclipse.shr5Management.Shr5managementPackage;
import de.urszeidler.eclipse.shr5Management.TrainingRate;

/**
* This is the item provider adapter for a {@link de.urszeidler.eclipse.shr5Management.TrainingRate} object.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -172,13 +170,13 @@ public Object getImage(Object object) {
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @generated not
*/
@Override
public String getText(Object object) {
TrainingRate trainingRate = (TrainingRate)object;
return getString("_UI_TrainingRate_type") + " " + trainingRate.getFrom();
}
return String.format("%s [%d - %d] new rating x %d %s",getString("_UI_TrainingRate_type") , trainingRate.getFrom(),trainingRate.getTo(),trainingRate.getFactor(),trainingRate.getTimeUnit());
}


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
*/
package de.urszeidler.eclipse.shr5Management.tests;

import de.urszeidler.eclipse.shr5Management.RangeTableEntry;

import junit.framework.TestCase;
import de.urszeidler.eclipse.shr5Management.RangeTableEntry;

/**
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
*/
package de.urszeidler.eclipse.shr5Management.tests;

import de.urszeidler.eclipse.shr5Management.RangeTable;

import junit.framework.TestCase;
import de.urszeidler.eclipse.shr5Management.RangeTable;

/**
* <!-- begin-user-doc -->
Expand Down
Loading

0 comments on commit 76a43bf

Please sign in to comment.