diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/UIConstants.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/UIConstants.java index 5f3b78c664..18941ab518 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/UIConstants.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/UIConstants.java @@ -30,11 +30,6 @@ interface File // NOSONAR String REMOVED = "file/removed"; //$NON-NLS-1$ } - interface Domain // NOSONAR - { - String SECURITY_CREATED = "domain/security-created"; //$NON-NLS-1$ - } - interface ExchangeRates // NOSONAR { String LOADED = "exchangeRates/loaded"; //$NON-NLS-1$ diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/handlers/NewDomainElementHandler.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/handlers/NewDomainElementHandler.java index 4596c1560e..175ab4d2f6 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/handlers/NewDomainElementHandler.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/handlers/NewDomainElementHandler.java @@ -35,6 +35,8 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import name.abuchen.portfolio.events.ChangeEventConstants; +import name.abuchen.portfolio.events.SecurityCreatedEvent; import name.abuchen.portfolio.model.Classification; import name.abuchen.portfolio.model.Client; import name.abuchen.portfolio.model.Exchange; @@ -126,10 +128,15 @@ private void openEditDialog(AbstractFinanceView view, Security newSecurity) view.getClient().markDirty(); new UpdateQuotesJob(view.getClient(), newSecurity).schedule(); - broker.post(UIConstants.Event.Domain.SECURITY_CREATED, newSecurity); + postSecurityCreatedEvent(view.getClient(), newSecurity); } } + private void postSecurityCreatedEvent(Client client, Security security) + { + broker.post(ChangeEventConstants.Security.CREATED, new SecurityCreatedEvent(client, security)); + } + private void createNewCryptocurrency(AbstractFinanceView view) { try @@ -226,7 +233,7 @@ private void createNewConsumerPriceIndex(AbstractFinanceView view) view.getClient().addSecurity(newSecurity); view.getClient().markDirty(); new UpdateQuotesJob(view.getClient(), newSecurity).schedule(); - broker.post(UIConstants.Event.Domain.SECURITY_CREATED, newSecurity); + postSecurityCreatedEvent(view.getClient(), newSecurity); } } } diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/SecurityListView.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/SecurityListView.java index f684d81459..f8ad44a79b 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/SecurityListView.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/SecurityListView.java @@ -35,6 +35,8 @@ import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Text; +import name.abuchen.portfolio.events.ChangeEventConstants; +import name.abuchen.portfolio.events.SecurityCreatedEvent; import name.abuchen.portfolio.model.Client; import name.abuchen.portfolio.model.LimitPrice; import name.abuchen.portfolio.model.PortfolioTransaction; @@ -92,8 +94,6 @@ public void menuAboutToShow(IMenuManager manager) UIConstants.Command.NEW_DOMAIN_ELEMENT, UIConstants.Parameter.TYPE, DomainElement.CONSUMER_PRICE_INDEX.name())); - - manager.add(new Separator()); manager.add(new Action(Messages.SecurityMenuImportCSV) @@ -381,16 +381,19 @@ public void setup(@Named(UIConstants.Parameter.VIEW_PARAMETER) Predicate