From 18e18d8f6600b57224c5853bbef7a329f66d703c Mon Sep 17 00:00:00 2001 From: Andreas Buchen Date: Fri, 15 Sep 2023 11:59:41 +0200 Subject: [PATCH] Replace use of deprecated Eclipse APIs --- .../Issue1897AddFeesToDividendTransactionsTest.java | 6 +++--- .../datatransfer/actions/InsertActionTest.java | 2 +- .../portfolio/ui/util/chart/TimelineChartToolTip.java | 4 ++-- .../abuchen/portfolio/ui/util/swt/StyledLabel.java | 10 +++++----- .../abuchen/portfolio/ui/views/PerformanceView.java | 2 +- .../portfolio/ui/views/StatementOfAssetsViewer.java | 2 +- .../portfolio/ui/views/payments/PaymentsMatrixTab.java | 2 +- .../ui/wizards/security/SecurityTaxonomyPage.java | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/name.abuchen.portfolio.tests/src/issues/Issue1897AddFeesToDividendTransactionsTest.java b/name.abuchen.portfolio.tests/src/issues/Issue1897AddFeesToDividendTransactionsTest.java index 56928f89b5..7cbb23fbe6 100644 --- a/name.abuchen.portfolio.tests/src/issues/Issue1897AddFeesToDividendTransactionsTest.java +++ b/name.abuchen.portfolio.tests/src/issues/Issue1897AddFeesToDividendTransactionsTest.java @@ -2,7 +2,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.isIn; +import static org.hamcrest.Matchers.in; import java.io.IOException; import java.time.LocalDate; @@ -68,8 +68,8 @@ public void testDefaultSnapshot() assertThat(feesCategory.getValuation(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(10.0 + 5.0)))); assertThat(snapshot.getFees().size(), is(2)); - assertThat(tx, isIn(snapshot.getFees().stream().map(pair -> (Transaction) pair.getTransaction()) - .collect(Collectors.toList()))); + assertThat(tx, is(in(snapshot.getFees().stream().map(pair -> (Transaction) pair.getTransaction()) + .collect(Collectors.toList())))); ClientPerformanceSnapshotTest.assertThatCalculationWorksOut(snapshot, converter); } diff --git a/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/actions/InsertActionTest.java b/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/actions/InsertActionTest.java index 1731b72a9e..cdcf9aa729 100644 --- a/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/actions/InsertActionTest.java +++ b/name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/actions/InsertActionTest.java @@ -2,7 +2,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.IsCollectionContaining.hasItem; +import static org.hamcrest.core.IsIterableContaining.hasItem; import java.beans.BeanInfo; import java.beans.IntrospectionException; diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/chart/TimelineChartToolTip.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/chart/TimelineChartToolTip.java index 1d1b48a245..6c55b08c04 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/chart/TimelineChartToolTip.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/chart/TimelineChartToolTip.java @@ -232,8 +232,8 @@ protected void createComposite(Composite parent) Label hint = new Label(data, SWT.NONE); hint.setText(Messages.TooltipHintPressAlt); - hint.setFont(this.resourceManager.createFont( - FontDescriptor.createFrom(data.getFont()).increaseHeight(-3).withStyle(SWT.ITALIC))); + hint.setFont(this.resourceManager + .create(FontDescriptor.createFrom(data.getFont()).increaseHeight(-3).withStyle(SWT.ITALIC))); GridDataFactory.fillDefaults().span(2, 1).applyTo(hint); } diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/swt/StyledLabel.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/swt/StyledLabel.java index c40598eb16..f83e3288e4 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/swt/StyledLabel.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/util/swt/StyledLabel.java @@ -181,7 +181,7 @@ public StyledLabel(Composite parent, int style) addListener(SWT.Dispose, this::handleDispose); addListener(SWT.MouseDown, this::openBrowser); addListener(SWT.MouseMove, this::updateCursor); - + initAccessibility(); } @@ -206,7 +206,7 @@ public void setText(String text) if (r.fontStyle != SWT.NORMAL) { Font font = resourceManager - .createFont(FontDescriptor.createFrom(textLayout.getFont()).setStyle(r.fontStyle)); + .create(FontDescriptor.createFrom(textLayout.getFont()).setStyle(r.fontStyle)); textLayout.setStyle(new TextStyle(font, r.foreground, r.background), r.start, r.start + r.length - 1); } @@ -235,7 +235,7 @@ public void setFont(Font font) for (TextStyle style : styles) { if (style.font != null) - style.font = resourceManager.createFont(FontDescriptor.createFrom(textLayout.getFont()) + style.font = resourceManager.create(FontDescriptor.createFrom(textLayout.getFont()) .setStyle(style.font.getFontData()[0].getStyle())); } @@ -290,7 +290,7 @@ private String getLinkUrlAtMousePointer(Event event) int offset = this.textLayout.getOffset(event.x, event.y, null); if (offset == -1) return null; - + Point mostLeftPoint = this.textLayout.getLocation(offset, false); Point mostRightPoint = this.textLayout.getLocation(offset, true); if (event.x < mostLeftPoint.x || event.x > mostRightPoint.x) @@ -302,7 +302,7 @@ private String getLinkUrlAtMousePointer(Event event) return String.valueOf(style.data); } - + private void initAccessibility() { getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/PerformanceView.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/PerformanceView.java index cf8a8a47a1..e88a595b08 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/PerformanceView.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/PerformanceView.java @@ -238,7 +238,7 @@ private void createCalculationItem(CTabFolder folder, String title) stylingEngine.style(calculation.getTree()); final Font boldFont = JFaceResources.getResources() - .createFont(FontDescriptor.createFrom(calculation.getTree().getFont()).setStyle(SWT.BOLD)); + .create(FontDescriptor.createFrom(calculation.getTree().getFont()).setStyle(SWT.BOLD)); ShowHideColumnHelper support = new ShowHideColumnHelper(getClass().getSimpleName() + "-calculation@v2", //$NON-NLS-1$ getPreferenceStore(), calculation, layout); diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/StatementOfAssetsViewer.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/StatementOfAssetsViewer.java index b0ff70cbf8..3fb8e3b515 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/StatementOfAssetsViewer.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/StatementOfAssetsViewer.java @@ -606,7 +606,7 @@ public Font getFont(Object e) stylingEngine.style(assets.getTable()); LocalResourceManager resources = new LocalResourceManager(JFaceResources.getResources(), assets.getTable()); - boldFont = resources.createFont(FontDescriptor.createFrom(assets.getTable().getFont()).setStyle(SWT.BOLD)); + boldFont = resources.create(FontDescriptor.createFrom(assets.getTable().getFont()).setStyle(SWT.BOLD)); return container; } diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/payments/PaymentsMatrixTab.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/payments/PaymentsMatrixTab.java index a4c11ace3e..78ba72134a 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/payments/PaymentsMatrixTab.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/payments/PaymentsMatrixTab.java @@ -120,7 +120,7 @@ public final Control createControl(Composite parent) stylingEngine.style(tableViewer.getTable()); LocalResourceManager resources = new LocalResourceManager(JFaceResources.getResources(), parent); - boldFont = resources.createFont(FontDescriptor.createFrom(tableViewer.getTable().getFont()).setStyle(SWT.BOLD)); + boldFont = resources.create(FontDescriptor.createFrom(tableViewer.getTable().getFont()).setStyle(SWT.BOLD)); createColumns(tableViewer, tableLayout); updateColumnOrder(); diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/SecurityTaxonomyPage.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/SecurityTaxonomyPage.java index f9b1ca60be..603b73bc48 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/SecurityTaxonomyPage.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/wizards/security/SecurityTaxonomyPage.java @@ -156,7 +156,7 @@ public void createControl(Composite parent) { LocalResourceManager resources = new LocalResourceManager(JFaceResources.getResources(), parent); - boldFont = resources.createFont(FontDescriptor.createFrom(parent.getFont()).setStyle(SWT.BOLD)); + boldFont = resources.create(FontDescriptor.createFrom(parent.getFont()).setStyle(SWT.BOLD)); scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); setControl(scrolledComposite);