Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ protected Point getSize() {
*/
@Override
public boolean equals(Object object) {
if (!(object instanceof CompositeDebugImageDescriptor)){
if (!(object instanceof CompositeDebugImageDescriptor other)){
return false;
}
CompositeDebugImageDescriptor other= (CompositeDebugImageDescriptor)object;
return (getBaseImage().equals(other.getBaseImage()) && getFlags() == other.getFlags());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ public static void launchInForeground(final ILaunchConfiguration configuration,
* Build & launch (98)
*/
final SubMonitor subMonitor = SubMonitor.convert(monitor, MessageFormat
.format(DebugUIMessages.DebugUIPlugin_25, new Object[] { configuration.getName() }), 100);
.format(DebugUIMessages.DebugUIPlugin_25, configuration.getName()), 100);
try {
jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, subMonitor.split(1));
jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, subMonitor.split(1));
Expand Down Expand Up @@ -1127,7 +1127,7 @@ public static void launchInForeground(final ILaunchConfiguration configuration,
* Setup progress monitor - Build & launch (1)
*/
final SubMonitor subMonitor = SubMonitor.convert(monitor, MessageFormat
.format(DebugUIMessages.DebugUIPlugin_25, new Object[] { configuration.getName() }), 1);
.format(DebugUIMessages.DebugUIPlugin_25, configuration.getName()), 1);
try {
buildAndLaunch(configuration, mode, subMonitor);
} catch (CoreException e) {
Expand All @@ -1151,8 +1151,7 @@ private static void handleInvocationTargetException(InvocationTargetException e,
if (targetException instanceof CoreException) {
t = targetException;
}
if (t instanceof CoreException) {
CoreException ce = (CoreException)t;
if (t instanceof CoreException ce) {
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(ce.getStatus());
if (handler != null) {
ILaunchGroup group = DebugUITools.getLaunchGroup(configuration, mode);
Expand Down Expand Up @@ -1207,7 +1206,7 @@ public static void launchInBackground(final ILaunchConfiguration configuration,
}
}
final boolean waitInJob = wait;
Job job = new Job(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()})) {
Job job = new Job(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, configuration.getName())) {
@Override
public IStatus run(final IProgressMonitor monitor) {
/* Setup progress monitor
Expand Down Expand Up @@ -1280,7 +1279,7 @@ public void done(IJobChangeEvent event) {

job.setPriority(Job.INTERACTIVE);
job.setProperty(IProgressConstants2.SHOW_IN_TASKBAR_ICON_PROPERTY, Boolean.TRUE);
job.setName(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()}));
job.setName(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, configuration.getName()));

if (wait) {
progressService.showInDialog(getShell(), job);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,15 @@ public String getImageKey(Object element) {
return IDebugUIConstants.IMG_OBJS_STACKFRAME;
}
return IDebugUIConstants.IMG_OBJS_STACKFRAME_RUNNING;
} else if (element instanceof IThread) {
IThread thread = (IThread)element;
} else if (element instanceof IThread thread) {
if (thread.isSuspended()) {
return IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED;
} else if (thread.isTerminated()) {
return IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED;
} else {
return IDebugUIConstants.IMG_OBJS_THREAD_RUNNING;
}
} else if (element instanceof IDebugTarget) {
IDebugTarget target= (IDebugTarget) element;
} else if (element instanceof IDebugTarget target) {
if (target.isTerminated() || target.isDisconnected()) {
return IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED;
} else if (target.isSuspended()) {
Expand All @@ -163,9 +161,8 @@ public String getImageKey(Object element) {
return IDebugUIConstants.IMG_OBJS_OS_PROCESS_TERMINATED;
}
return IDebugUIConstants.IMG_OBJS_OS_PROCESS;
} else if (element instanceof ILaunch) {
} else if (element instanceof ILaunch launch) {
// determine the image from the launch config type
ILaunch launch= (ILaunch)element;
ILaunchConfiguration configuration = launch.getLaunchConfiguration();
if (configuration != null) {
try {
Expand Down Expand Up @@ -237,8 +234,7 @@ public String getText(Object element) {
label.append(((ILaunchConfiguration)element).getName());
} else if (element instanceof ILaunchConfigurationType) {
label.append(((ILaunchConfigurationType)element).getName());
} else if(element instanceof ILaunchDelegate) {
ILaunchDelegate delegate = (ILaunchDelegate) element;
} else if(element instanceof ILaunchDelegate delegate) {
String name = delegate.getName();
if(name == null) {
name = delegate.getContributorName();
Expand All @@ -255,10 +251,9 @@ public String getText(Object element) {
if (element instanceof ITerminate) {
if (((ITerminate) element).isTerminated()) {
String terminatedMessage= null;
if (element instanceof IProcess) {
IProcess process = (IProcess)element;
if (element instanceof IProcess process) {
int exit = process.getExitValue();
terminatedMessage = MessageFormat.format(DebugUIMessages.DefaultLabelProvider_16, new Object[] { Integer.toString(exit) });
terminatedMessage = MessageFormat.format(DebugUIMessages.DefaultLabelProvider_16, Integer.toString(exit));
} else {
terminatedMessage= DebugUIMessages.DefaultLabelProvider_1;
}
Expand Down Expand Up @@ -290,7 +285,7 @@ private String getBreakpointText(IBreakpoint breakpoint) {
if (breakpoint instanceof ILineBreakpoint) {
try {
int lineNumber = ((ILineBreakpoint)breakpoint).getLineNumber();
label.append(MessageFormat.format(DebugUIMessages.DefaultLabelProvider_17, new Object[] { Integer.toString(lineNumber) }));
label.append(MessageFormat.format(DebugUIMessages.DefaultLabelProvider_17, Integer.toString(lineNumber)));
} catch (CoreException e) {
}
}
Expand Down Expand Up @@ -437,8 +432,7 @@ protected String getBreakpointImageKey(IBreakpoint breakpoint) {
if (breakpoint != null && breakpoint.getMarker().exists()) {
try {
boolean enabled = breakpoint.isEnabled();
if (breakpoint instanceof IWatchpoint) {
IWatchpoint watchpoint = (IWatchpoint) breakpoint;
if (breakpoint instanceof IWatchpoint watchpoint) {
if (watchpoint.isAccess()) {
if (watchpoint.isModification()) {
//access and modification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,9 @@ public boolean isLabelProperty(Object element, String property) {
*/
protected IDebugModelPresentation getConfiguredPresentation(Object element) {
String id= null;
if (element instanceof IDebugElement) {
IDebugElement de= (IDebugElement) element;
if (element instanceof IDebugElement de) {
id= de.getModelIdentifier();
} else if (element instanceof IMarker) {
IMarker m= (IMarker) element;
} else if (element instanceof IMarker m) {
IBreakpoint bp = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(m);
if (bp != null) {
id= bp.getModelIdentifier();
Expand Down Expand Up @@ -320,8 +318,7 @@ protected HashMap<String, IDebugModelPresentation> getLabelProviders() {
@Override
public Color getForeground(Object element) {
IDebugModelPresentation presentation = getConfiguredPresentation(element);
if (presentation instanceof IColorProvider) {
IColorProvider colorProvider = (IColorProvider) presentation;
if (presentation instanceof IColorProvider colorProvider) {
return colorProvider.getForeground(element);
}
return null;
Expand All @@ -330,8 +327,7 @@ public Color getForeground(Object element) {
@Override
public Color getBackground(Object element) {
IDebugModelPresentation presentation = getConfiguredPresentation(element);
if (presentation instanceof IColorProvider) {
IColorProvider colorProvider = (IColorProvider) presentation;
if (presentation instanceof IColorProvider colorProvider) {
return colorProvider.getBackground(element);
}
return null;
Expand All @@ -340,8 +336,7 @@ public Color getBackground(Object element) {
@Override
public Font getFont(Object element) {
IDebugModelPresentation presentation = getConfiguredPresentation(element);
if (presentation instanceof IFontProvider) {
IFontProvider fontProvider = (IFontProvider) presentation;
if (presentation instanceof IFontProvider fontProvider) {
return fontProvider.getFont(element);
}
return null;
Expand All @@ -354,9 +349,8 @@ public Annotation getInstructionPointerAnnotation(IEditorPart editorPart, IStack
String id = null;
Image image = null;
String text = null;
if (presentation instanceof IInstructionPointerPresentation) {
if (presentation instanceof IInstructionPointerPresentation pointerPresentation) {
// first check if an annotaion object is provided
IInstructionPointerPresentation pointerPresentation = (IInstructionPointerPresentation) presentation;
annotation = pointerPresentation.getInstructionPointerAnnotation(editorPart, frame);
if (annotation == null) {
// next check for a marker annotation specification extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public InstructionPointerContext(IDebugTarget target, IThread thread, ITextEdito

@Override
public boolean equals(Object other) {
if (other instanceof InstructionPointerContext) {
InstructionPointerContext otherContext = (InstructionPointerContext) other;
if (other instanceof InstructionPointerContext otherContext) {
if (getAnnotation().equals(otherContext.getAnnotation())){
return getEditor().equals(otherContext.getEditor());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ public Map<String, Object> getAttributes() {
@Override
public Color getForeground(Object element) {
IDebugModelPresentation presentation = getPresentation();
if (presentation instanceof IColorProvider) {
IColorProvider colorProvider = (IColorProvider) presentation;
if (presentation instanceof IColorProvider colorProvider) {
return colorProvider.getForeground(element);
}
return null;
Expand All @@ -406,8 +405,7 @@ public Color getForeground(Object element) {
@Override
public Color getBackground(Object element) {
IDebugModelPresentation presentation = getPresentation();
if (presentation instanceof IColorProvider) {
IColorProvider colorProvider = (IColorProvider) presentation;
if (presentation instanceof IColorProvider colorProvider) {
return colorProvider.getBackground(element);
}
return null;
Expand All @@ -416,8 +414,7 @@ public Color getBackground(Object element) {
@Override
public Font getFont(Object element) {
IDebugModelPresentation presentation = getPresentation();
if (presentation instanceof IFontProvider) {
IFontProvider fontProvider = (IFontProvider) presentation;
if (presentation instanceof IFontProvider fontProvider) {
return fontProvider.getFont(element);
}
return null;
Expand All @@ -426,8 +423,7 @@ public Font getFont(Object element) {
@Override
public Annotation getInstructionPointerAnnotation(IEditorPart editorPart, IStackFrame frame) {
IDebugModelPresentation presentation = getPresentation();
if (presentation instanceof IInstructionPointerPresentation) {
IInstructionPointerPresentation pointerPresentation = (IInstructionPointerPresentation) presentation;
if (presentation instanceof IInstructionPointerPresentation pointerPresentation) {
return pointerPresentation.getInstructionPointerAnnotation(editorPart, frame);
}
return null;
Expand All @@ -436,8 +432,7 @@ public Annotation getInstructionPointerAnnotation(IEditorPart editorPart, IStack
@Override
public String getInstructionPointerAnnotationType(IEditorPart editorPart, IStackFrame frame) {
IDebugModelPresentation presentation = getPresentation();
if (presentation instanceof IInstructionPointerPresentation) {
IInstructionPointerPresentation pointerPresentation = (IInstructionPointerPresentation) presentation;
if (presentation instanceof IInstructionPointerPresentation pointerPresentation) {
return pointerPresentation.getInstructionPointerAnnotationType(editorPart, frame);
}
return null;
Expand All @@ -446,8 +441,7 @@ public String getInstructionPointerAnnotationType(IEditorPart editorPart, IStack
@Override
public Image getInstructionPointerImage(IEditorPart editorPart, IStackFrame frame) {
IDebugModelPresentation presentation = getPresentation();
if (presentation instanceof IInstructionPointerPresentation) {
IInstructionPointerPresentation pointerPresentation = (IInstructionPointerPresentation) presentation;
if (presentation instanceof IInstructionPointerPresentation pointerPresentation) {
return pointerPresentation.getInstructionPointerImage(editorPart, frame);
}
return null;
Expand All @@ -456,8 +450,7 @@ public Image getInstructionPointerImage(IEditorPart editorPart, IStackFrame fram
@Override
public String getInstructionPointerText(IEditorPart editorPart, IStackFrame frame) {
IDebugModelPresentation presentation = getPresentation();
if (presentation instanceof IInstructionPointerPresentation) {
IInstructionPointerPresentation pointerPresentation = (IInstructionPointerPresentation) presentation;
if (presentation instanceof IInstructionPointerPresentation pointerPresentation) {
return pointerPresentation.getInstructionPointerText(editorPart, frame);
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,9 @@ private boolean matchesContentType(IContentType type, String typeId) {
* @return whether or not the given resource has the given content type
*/
private boolean matchesContentType(IResource resource, String contentType) {
if (resource == null || !(resource instanceof IFile) || !resource.exists()) {
if (resource == null || !(resource instanceof IFile file) || !resource.exists()) {
return false;
}
IFile file = (IFile) resource;
IContentDescription description;
try {
description = file.getContentDescription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public void dispose() {

@Override
public void selectionChanged(IAction action, ISelection s) {
if (s instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) s;
if (s instanceof IStructuredSelection ss) {
action.setEnabled(getEnableStateForSelection(ss));
setSelection(ss);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected boolean updateSelection(IStructuredSelection selection) {
setGroup(group);
setLaunchConfiguration(configuration);
setMode(launch.getLaunchMode());
setText(MessageFormat.format(ActionMessages.AddToFavoritesAction_1, new Object[] { DebugUIPlugin.removeAccelerators(getGroup().getLabel()) }));
setText(MessageFormat.format(ActionMessages.AddToFavoritesAction_1, DebugUIPlugin.removeAccelerators(getGroup().getLabel())));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected boolean updateSelection(IStructuredSelection selection) {
setLaunchConfiguration(configuration);
setMode(launch.getLaunchMode());
setIsTerminated(launch.isTerminated());
setText(MessageFormat.format(ActionMessages.EditLaunchConfigurationAction_1, new Object[] { configuration.getName() }));
setText(MessageFormat.format(ActionMessages.EditLaunchConfigurationAction_1, configuration.getName()));
ImageDescriptor descriptor = null;
try {
descriptor = DebugPluginImages.getImageDescriptor(configuration.getType().getIdentifier());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public class LaunchConfigurationAction extends Action {
* @param image the image for the action
*/
public LaunchConfigurationAction(ILaunchConfiguration config, String mode, String text, ImageDescriptor image, int accelerator) {
super(MessageFormat.format(ActionMessages.LaunchConfigurationAction_0, new Object[] {
Integer.toString(accelerator), text }), image);
super(MessageFormat.format(ActionMessages.LaunchConfigurationAction_0, Integer.toString(accelerator), text), image);
fConfig = config;
fMode = mode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ public void run(IAction action) {
@Override
public void selectionChanged(IAction action, ISelection selection) {
// if the active part did not provide an adapter, see if the selection does
if (fTargetAdapter == null && selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (fTargetAdapter == null && selection instanceof IStructuredSelection ss) {
if (!ss.isEmpty()) {
Object object = ss.getFirstElement();
if (object instanceof IAdaptable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class DebugContextListener implements IDebugContextListener {

protected void contextActivated(ISelection selection) {
fTargetElement = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (selection instanceof IStructuredSelection ss) {
if (ss.size() == 1) {
fTargetElement = (ISuspendResume)
DebugPlugin.getAdapter(ss.getFirstElement(), ISuspendResume.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection)
private static class ToggleBreakpointsTargetAdapterFactory implements IToggleBreakpointsTargetFactory {

private Object getSelectionElement(ISelection selection) {
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection)selection;
if (selection instanceof IStructuredSelection ss) {
return ss.getFirstElement();
}
return null;
Expand Down Expand Up @@ -735,8 +734,7 @@ public IBreakpoint getBeakpointFromEditor(ITextEditor editor, IVerticalRulerInfo
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
while (iterator.hasNext()) {
Annotation annot = iterator.next();
if (annot instanceof SimpleMarkerAnnotation) {
SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) annot;
if (annot instanceof SimpleMarkerAnnotation markerAnnotation) {
IMarker marker = markerAnnotation.getMarker();
try {
if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public void run(IAction action) {
IAction pasteAction = ((AbstractDebugView)getView()).getAction(IDebugView.PASTE_ACTION);
// update the enablement of the paste action
// workaround since the clipboard does not suppot callbacks
if (pasteAction instanceof PasteBreakpointsAction) {
PasteBreakpointsAction pba = (PasteBreakpointsAction) pasteAction;
if (pasteAction instanceof PasteBreakpointsAction pba) {
if (pba.getStructuredSelection() != null) {
pba.selectionChanged(pba.getStructuredSelection());
}
Expand Down Expand Up @@ -80,12 +79,11 @@ public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas)
// remove deleted breakpoints from drag/drop clipboard
if (fStamp == LocalSelectionTransfer.getTransfer().getSelectionSetTime()) {
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
if (selection instanceof IStructuredSelection) {
if (selection instanceof IStructuredSelection ss) {
Set<IBreakpoint> removed = new HashSet<>();
Collections.addAll(removed, breakpoints);
boolean modified = false;
List<Object> remain = new ArrayList<>();
IStructuredSelection ss = (IStructuredSelection) selection;
Iterator<?> iterator = ss.iterator();
while (iterator.hasNext()) {
Object bp = iterator.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,10 @@ public void run(IAction action) {
@Override
public void selectionChanged(IAction action, ISelection sel) {
fSet = null;
if (sel instanceof IStructuredSelection) {
IStructuredSelection selection= (IStructuredSelection) sel;

if (sel instanceof IStructuredSelection selection) {
if (selection.size() == 1) {
Object element = selection.getFirstElement();
if (element instanceof IBreakpointContainer) {
IBreakpointContainer container = (IBreakpointContainer)element;
if (element instanceof IBreakpointContainer container) {
IAdaptable category = container.getCategory();
if (category instanceof WorkingSetCategory) {
IWorkingSet set = ((WorkingSetCategory)category).getWorkingSet();
Expand Down
Loading
Loading