Skip to content

Commit

Permalink
Replace use of deprecated Eclipse APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
buchen committed Sep 15, 2023
1 parent 01f1ac7 commit 18e18d8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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);
}
Expand Down Expand Up @@ -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()));
}

Expand Down Expand Up @@ -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)
Expand All @@ -302,7 +302,7 @@ private String getLinkUrlAtMousePointer(Event event)

return String.valueOf(style.data);
}

private void initAccessibility()
{
getAccessible().addAccessibleControlListener(new AccessibleControlAdapter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 18e18d8

Please sign in to comment.