Skip to content

Commit

Permalink
fix(deps): bump com.vegardit.no-npe:no-npe-eea-all from 1.1.0 to 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Dec 19, 2024
1 parent acd8dac commit 38cb434
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 69 deletions.
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.debug/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Debug Adapter client for Eclipse IDE (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.debug;singleton:=true
Bundle-Vendor: Eclipse LSP4E
Bundle-Version: 0.15.12.qualifier
Bundle-Version: 0.15.13.qualifier
Bundle-Activator: org.eclipse.lsp4e.debug.DSPPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static ImageDescriptor createManaged(ImageRegistry registry, String pref
return result;
}

public static Image get(String key) {
public static @Nullable Image get(String key) {
return imageRegistry.get(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ public String getName() {
}

@Override
public String getId() {
public @Nullable String getId() {
return "org.eclipse.lsp4e.debug.launcher.DSPMainTab";
}

@Override
public Image getImage() {
public @Nullable Image getImage() {
return DSPImages.get(DSPImages.IMG_VIEW_DEBUGGER_TAB);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
*******************************************************************************/
package org.eclipse.lsp4e.debug.launcher;

import org.eclipse.jdt.annotation.Nullable;

public class DSPOverrideSettingsTab extends DSPMainTab {

public DSPOverrideSettingsTab() {
super(true);
}

@Override
public String getId() {
public @Nullable String getId() {
return "org.eclipse.lsp4e.debug.launcher.DSPOverrideSettingsTab";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,7 @@ private static boolean supportsWorkspaceFolders(@Nullable ServerCapabilities ser

private void logMessage(Message message) {
if (message instanceof ResponseMessage responseMessage && responseMessage.getError() != null
&& responseMessage.getId()
.equals(Integer.toString(ResponseErrorCode.RequestCancelled.getValue()))) {
&& Integer.toString(ResponseErrorCode.RequestCancelled.getValue()).equals(responseMessage.getId())) {
LanguageServerPlugin.logError(new ResponseErrorException(responseMessage.getError()));
} else if (LanguageServerPlugin.DEBUG) {
LanguageServerPlugin.logInfo(message.getClass().getSimpleName() + '\n' + message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.lsp4e;

import static org.eclipse.lsp4e.internal.NullSafetyHelper.castNonNull;

import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
Expand Down Expand Up @@ -293,7 +295,7 @@ private void initialize() {
try {
String description = enabledWhen.getAttribute(ENABLED_WHEN_DESC);
expression = new EnablementTester(this::evaluationContext,
ExpressionConverter.getDefault().perform(enabledWhenChildren[0]),
castNonNull(ExpressionConverter.getDefault().perform(enabledWhenChildren[0])),
description);
} catch (CoreException e) {
LanguageServerPlugin.logWarning(e.getMessage(), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private static void appendAsHexString(StringBuilder buffer, int intValue) {
}

@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
public @Nullable IInformationControlCreator getInformationPresenterControlCreator() {
return parent -> {
if (BrowserInformationControl.isAvailable(parent)) {
final var res = new FocusableBrowserInformationControl(parent, JFaceResources.DEFAULT_FONT, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
highlightJob.schedule();
}

private @Nullable String getValueInRange(IRegion selectedRegion, VerifyEvent event, int offset, int length) {
private @Nullable String getValueInRange(@Nullable IRegion selectedRegion, VerifyEvent event, int offset, int length) {
if (selectedRegion == null)
return null;

if (offset < selectedRegion.getOffset() || offset > selectedRegion.getOffset() + selectedRegion.getLength()) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.eclipse.lsp4e.LSPEclipseUtils;
import org.eclipse.lsp4e.LanguageServerPlugin;
import org.eclipse.lsp4e.internal.LSPDocumentAbstractHandler;
import org.eclipse.lsp4e.ui.UI;
import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.texteditor.ITextEditor;

/**
Expand All @@ -41,7 +41,7 @@ protected void execute(ExecutionEvent event, ITextEditor textEditor) {
if (document != null) {
try {
final var query = new LSSearchQuery(textSelection.getOffset(), document);
HandlerUtil.getActiveShell(event).getDisplay().asyncExec(() -> NewSearchUI.runQueryInBackground(query));
UI.getDisplay().asyncExec(() -> NewSearchUI.runQueryInBackground(query));
} catch (Exception e) {
LanguageServerPlugin.logError(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,29 @@ protected void execute(ExecutionEvent event, ITextEditor textEditor) {

if (provider != null && provider.getSelection() instanceof ITextSelection textSelection && !textSelection.isEmpty()) {
IDocument document = LSPEclipseUtils.getDocument(textEditor);
if (document != null) {
IEditorPart part = HandlerUtil.getActiveEditor(event);
Shell shell = part.getSite().getShell();
LanguageServerDocumentExecutor executor = LanguageServers.forDocument(document).withCapability(ServerCapabilities::getRenameProvider);
if (executor.anyMatching()) {
int offset = textSelection.getOffset();
if (document == null)
return;

final var processor = new LSPRenameProcessor(document, offset);
final var refactoring = new ProcessorBasedRefactoring(processor);
final var wizard = new LSPRenameRefactoringWizard(refactoring);
final var operation = new RefactoringWizardOpenOperation(wizard);
shell.getDisplay().asyncExec(() -> {
try {
operation.run(shell, Messages.rename_title);
} catch (InterruptedException e1) {
LanguageServerPlugin.logError(e1);
Thread.currentThread().interrupt();
}
});
}
IEditorPart part = HandlerUtil.getActiveEditor(event);
if(part == null)
return;
Shell shell = part.getSite().getShell();
LanguageServerDocumentExecutor executor = LanguageServers.forDocument(document).withCapability(ServerCapabilities::getRenameProvider);
if (executor.anyMatching()) {
int offset = textSelection.getOffset();

final var processor = new LSPRenameProcessor(document, offset);
final var refactoring = new ProcessorBasedRefactoring(processor);
final var wizard = new LSPRenameRefactoringWizard(refactoring);
final var operation = new RefactoringWizardOpenOperation(wizard);
shell.getDisplay().asyncExec(() -> {
try {
operation.run(shell, Messages.rename_title);
} catch (InterruptedException e1) {
LanguageServerPlugin.logError(e1);
Thread.currentThread().interrupt();
}
});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,23 @@ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
}

public String getPlaceholder() {
@Nullable
String placeholder = null;
if (prepareRenameResult != null) {
placeholder = prepareRenameResult.map(range -> {
final var prepareRenameResult = this.prepareRenameResult;
if (prepareRenameResult == null)
return "newName"; //$NON-NLS-1$

final String placeholder = prepareRenameResult.map(range -> {
try {
int startOffset = LSPEclipseUtils.toOffset(range.getStart(), document);
int endOffset = LSPEclipseUtils.toOffset(range.getEnd(), document);
return document.get(startOffset, endOffset - startOffset);
} catch (BadLocationException e) {
LanguageServerPlugin.logError(e);
return null;
return ""; //$NON-NLS-1$
}
}, PrepareRenameResult::getPlaceholder, options -> null);
}
return placeholder != null && !placeholder.isBlank() ? placeholder : "newName"; //$NON-NLS-1$
}, PrepareRenameResult::getPlaceholder, options -> ""); //$NON-NLS-1$
return placeholder != null && !placeholder.isBlank()
? placeholder
: "newName"; //$NON-NLS-1$
}

public static boolean isPrepareRenameProvider(@Nullable ServerCapabilities serverCapabilities) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import static org.eclipse.lsp4e.internal.NullSafetyHelper.lateNonNull;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.lsp4e.ui.Messages;
import org.eclipse.ltk.core.refactoring.Refactoring;
Expand Down Expand Up @@ -82,7 +83,7 @@ public void createControl(Composite parent) {
}

@Override
public IWizardPage getNextPage() {
public @Nullable IWizardPage getNextPage() {
this.setNewName();
return super.getNextPage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ public class LSPSymbolInWorkspaceHandler extends LSPDocumentAbstractHandler {
if (code != IDialogConstants.OK_ID) {
return null;
}
final var symbolInformation = ((WorkspaceSymbol) dialog.getFirstResult()).getLocation();
if (symbolInformation.isLeft()) {
LSPEclipseUtils.openInEditor(symbolInformation.getLeft());
} else if (symbolInformation.isRight()) {
LSPEclipseUtils.open(symbolInformation.getRight().getUri(), null);
if(dialog.getFirstResult() instanceof WorkspaceSymbol wsSymbol) {
final var symbolInformation = wsSymbol.getLocation();
if (symbolInformation.isLeft()) {
LSPEclipseUtils.openInEditor(symbolInformation.getLeft());
} else if (symbolInformation.isRight()) {
LSPEclipseUtils.open(symbolInformation.getRight().getUri(), null);
}
}

return null;
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LSPImages.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ private static final void declareRegistryImage(String key, String path) {
/**
* Returns the <code>Image</code> identified by the given key, or <code>null</code> if it does not exist.
*/
public static Image getImage(String key) {
public static @Nullable Image getImage(String key) {
return getImageRegistry().get(key);
}

/**
* Returns the <code>ImageDescriptor</code> identified by the given key, or <code>null</code> if it does not exist.
*/
public static ImageDescriptor getImageDescriptor(String key) {
public static @Nullable ImageDescriptor getImageDescriptor(String key) {
return getImageRegistry().getDescriptor(key);
}

Expand Down
43 changes: 22 additions & 21 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/LanguageServersView.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,29 @@ public void createPartControl(Composite parent) {
createColumn(EMPTY, 26, new ColumnLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final var lsWrapper = (LanguageServerWrapper) cell.getElement();
final var item = (TableItem) cell.getItem();
final var buttons = actionButtons.computeIfAbsent(lsWrapper, unused -> {
final var toolBar = new ToolBar((Composite) cell.getViewerRow().getControl(), SWT.FLAT);
toolBar.setBackground(cell.getBackground());
final var terminateButton = new ToolItem(toolBar, SWT.PUSH);
terminateButton.setImage(LSPImages.getImage(LSPImages.IMG_TERMINATE_CO));
terminateButton.setToolTipText("Terminate this language server"); //$NON-NLS-1$
terminateButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
lsWrapper.stop();
updateViewerInput();
}
if(cell.getElement() instanceof LanguageServerWrapper lsWrapper) {
final var item = (TableItem) cell.getItem();
final var buttons = actionButtons.computeIfAbsent(lsWrapper, unused -> {
final var toolBar = new ToolBar((Composite) cell.getViewerRow().getControl(), SWT.FLAT);
toolBar.setBackground(cell.getBackground());
final var terminateButton = new ToolItem(toolBar, SWT.PUSH);
terminateButton.setImage(LSPImages.getImage(LSPImages.IMG_TERMINATE_CO));
terminateButton.setToolTipText("Terminate this language server"); //$NON-NLS-1$
terminateButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
lsWrapper.stop();
updateViewerInput();
}
});
return toolBar;
});
return toolBar;
});
final var editor = new TableEditor(item.getParent());
editor.setEditor(buttons, item, cell.getColumnIndex());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.layout();
final var editor = new TableEditor(item.getParent());
editor.setEditor(buttons, item, cell.getColumnIndex());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.layout();
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<!-- External Eclipse null Annotations, see https://github.com/vegardit/no-npe -->
<groupId>com.vegardit.no-npe</groupId>
<artifactId>no-npe-eea-all</artifactId>
<version>1.1.0</version>
<version>1.3.0</version>
<type>jar</type>
</dependency>
</dependencies>
Expand Down

0 comments on commit 38cb434

Please sign in to comment.