diff --git a/team/bundles/org.eclipse.compare.win32/META-INF/MANIFEST.MF b/team/bundles/org.eclipse.compare.win32/META-INF/MANIFEST.MF index f98167fde70..bfb974de7a1 100644 --- a/team/bundles/org.eclipse.compare.win32/META-INF/MANIFEST.MF +++ b/team/bundles/org.eclipse.compare.win32/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.compare.win32;singleton:=true -Bundle-Version: 1.3.500.qualifier +Bundle-Version: 1.3.600.qualifier Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: JavaSE-17 Eclipse-PlatformFilter: (osgi.os=win32) diff --git a/team/bundles/org.eclipse.compare.win32/pom.xml b/team/bundles/org.eclipse.compare.win32/pom.xml index 2601db1c090..81425c49b4c 100644 --- a/team/bundles/org.eclipse.compare.win32/pom.xml +++ b/team/bundles/org.eclipse.compare.win32/pom.xml @@ -18,7 +18,7 @@ ../../ org.eclipse.compare.win32 - 1.3.500-SNAPSHOT + 1.3.600-SNAPSHOT eclipse-plugin diff --git a/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/AbstractMergeViewer.java b/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/AbstractMergeViewer.java index 0543d4fece1..8d0a51af6a7 100644 --- a/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/AbstractMergeViewer.java +++ b/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/AbstractMergeViewer.java @@ -101,8 +101,7 @@ public void setSelection(ISelection selection, boolean reveal) { } protected boolean isOneSided() { - if (input instanceof ICompareInput) { - ICompareInput ci = (ICompareInput) input; + if (input instanceof ICompareInput ci) { int type = ci.getKind() & Differencer.CHANGE_TYPE_MASK; return type != Differencer.CHANGE; } @@ -111,14 +110,16 @@ protected boolean isOneSided() { protected File getFileForSingleSide() throws CoreException { File file = getFileForLeft(); - if (file != null && file.exists()) + if (file != null && file.exists()) { return file; + } return getFileForRight(); } protected File getFileForRight() throws CoreException { - if (rightFile != null) + if (rightFile != null) { return rightFile; + } ICompareInput ci = getCompareInput(); if (ci != null) { ITypedElement right = ci.getRight(); @@ -133,8 +134,9 @@ protected File getFileForRight() throws CoreException { } protected File getFileForLeft() throws CoreException { - if (leftFile != null) + if (leftFile != null) { return leftFile; + } ICompareInput ci = getCompareInput(); if (ci != null) { ITypedElement left = ci.getLeft(); @@ -149,8 +151,9 @@ protected File getFileForLeft() throws CoreException { } protected File getResultFile() throws IOException { - if (resultFile != null) + if (resultFile != null) { return resultFile; + } resultFile = File.createTempFile("merge", ".doc"); //$NON-NLS-1$ //$NON-NLS-2$ resultFile.deleteOnExit(); // Need to delete the file so that clients will know that the files doesn't exist yet @@ -163,8 +166,7 @@ protected boolean hasResultFile() { } private File cacheContents(ITypedElement element) throws CoreException { - if (element instanceof IStreamContentAccessor) { - IStreamContentAccessor sca = (IStreamContentAccessor) element; + if (element instanceof IStreamContentAccessor sca) { InputStream contents = sca.getContents(); if (contents != null) { try { @@ -216,15 +218,13 @@ protected File getLocalFile(ITypedElement left) throws CoreException { } protected IFile getEclipseFile(Object element) { - if (element instanceof IResourceProvider) { - IResourceProvider rp = (IResourceProvider) element; + if (element instanceof IResourceProvider rp) { IResource resource = rp.getResource(); if (resource.getType() == IResource.FILE) { return (IFile)resource; } } - if (element instanceof IAdaptable) { - IAdaptable a = (IAdaptable) element; + if (element instanceof IAdaptable a) { Object result = a.getAdapter(IResource.class); if (result == null) { result = a.getAdapter(IFile.class); diff --git a/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordComparison.java b/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordComparison.java index 4cffb91500f..2dc242aa4d7 100644 --- a/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordComparison.java +++ b/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordComparison.java @@ -79,8 +79,9 @@ private static OleAutomation getAutomationProperty(OleAutomation auto, String na Variant varResult = getVariantProperty(auto, name); try { OleAutomation automation = varResult.getAutomation(); - if (automation != null) + if (automation != null) { return automation; + } } finally { varResult.dispose(); } @@ -92,8 +93,9 @@ private static OleAutomation getAutomationResult(OleAutomation auto, String comm if (varResult != null) { try { OleAutomation result = varResult.getAutomation(); - if (result != null) + if (result != null) { return result; + } } finally { varResult.dispose(); } @@ -106,8 +108,9 @@ private static OleAutomation getAutomationResult(OleAutomation auto, String comm if (varResult != null) { try { OleAutomation result = varResult.getAutomation(); - if (result != null) + if (result != null) { return result; + } } finally { varResult.dispose(); } @@ -134,7 +137,9 @@ private static int property(OleAutomation auto, OleAutomation reference, String if (ids != null) { return ids[0]; } - if(reference == null) throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_4, name)) ; + if(reference == null) { + throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_4, name)) ; + } // the property was not retrieved at that point, try to get it from the reference object ids = reference.getIDsOfNames(new String[] { name }); @@ -146,7 +151,9 @@ private static int property(OleAutomation auto, OleAutomation reference, String private static int property(OleAutomation auto, String name) { int[] ids = auto.getIDsOfNames(new String[] { name }); - if (ids == null) throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_4, name)); + if (ids == null) { + throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_4, name)); + } return ids[0]; } @@ -205,8 +212,9 @@ public void createWorkingCopy(String baseDocument, String revisedDocument, Strin OleAutomation activeDocument = getActiveDocument(application); try { Variant varResult = invoke(activeDocument, document, "SaveAs", workingCopy); //$NON-NLS-1$ - if (varResult == null) + if (varResult == null) { throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_6, workingCopy)); + } varResult.dispose(); } finally { closeDocument(activeDocument, document); @@ -251,8 +259,9 @@ private void closeDocument(OleAutomation document, OleAutomation reference) { private void compareDocument(OleAutomation document, String baseDocument, String revisedDocument) { // Compare to the second document: compare = destination.Compare(p1) Variant varResult = invoke(document, "Compare", baseDocument); //$NON-NLS-1$ - if (varResult == null) + if (varResult == null) { throw new SWTException(NLS.bind(CompareWin32Messages.WordComparison_9, baseDocument, revisedDocument)); + } varResult.dispose(); } @@ -361,7 +370,9 @@ private void disposeSite() { } public void saveAsDocument(String doc) { - if (site == null || site.isDisposed()) return; + if (site == null || site.isDisposed()) { + return; + } if (inplace) { site.deactivateInPlaceClient(); site.save(new File(doc), true); @@ -415,8 +426,9 @@ public boolean isDirty() { */ protected void initializeWorkbenchMenus(IWorkbenchWindow window) { //If there was an OLE Error or nothing has been created yet - if (frame == null || frame.isDisposed()) + if (frame == null || frame.isDisposed()) { return; + } // Get the browser menu bar. If one does not exist then // create it. Shell shell = frame.getShell(); @@ -434,13 +446,14 @@ protected void initializeWorkbenchMenus(IWorkbenchWindow window) { for (int i = 0; i < menuBar.getItemCount(); i++) { MenuItem item = menuBar.getItem(i); String id = ""; //$NON-NLS-1$ - if (item.getData() instanceof IMenuManager) + if (item.getData() instanceof IMenuManager) { id = ((IMenuManager) item.getData()).getId(); - if (id.equals(IWorkbenchActionConstants.M_FILE)) + } + if (id.equals(IWorkbenchActionConstants.M_FILE)) { fileMenu[0] = item; - else if (id.equals(IWorkbenchActionConstants.M_WINDOW)) + } else if (id.equals(IWorkbenchActionConstants.M_WINDOW)) { windowMenu[0] = item; - else { + } else { if (window.isApplicationMenu(id)) { containerItems.addElement(item); } diff --git a/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java b/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java index 102c441d104..c3da0ac769b 100644 --- a/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java +++ b/team/bundles/org.eclipse.compare.win32/src/org/eclipse/compare/internal/win32/WordMergeViewer.java @@ -164,8 +164,9 @@ private static void initAction(IAction a, ResourceBundle bundle, String prefix) } ImageDescriptor id= getImageDescriptor(dPath); // we set the disabled image first (see PR 1GDDE87) - if (id != null) + if (id != null) { a.setDisabledImageDescriptor(id); + } id= getImageDescriptor(ePath); if (id != null) { a.setImageDescriptor(id); @@ -176,8 +177,9 @@ private static void initAction(IAction a, ResourceBundle bundle, String prefix) private static ImageDescriptor getImageDescriptor(String relativePath) { IPath path= IPath.fromOSString("$nl$/icons/full/").append(relativePath); URL url= FileLocator.find(Activator.getDefault().getBundle(), path, null); - if (url == null) + if (url == null) { return null; + } return ImageDescriptor.createFromURL(url); } @@ -205,8 +207,9 @@ private Composite createComposite(Composite parent) { } private void updateEnablements() { - if (saveAction != null) + if (saveAction != null) { saveAction.setEnabled(isDirty()); + } inplaceAction.setChecked(wordArea.isInplace()); inplaceAction.setEnabled(wordArea.isOpen()); } @@ -358,8 +361,7 @@ private String getTextDescription() { if (saveAction != null &&hasResultFile()) { IEditableContent saveTarget = getSaveTarget(); String name = CompareWin32Messages.WordMergeViewer_3; - if (saveTarget instanceof ITypedElement) { - ITypedElement te = (ITypedElement) saveTarget; + if (saveTarget instanceof ITypedElement te) { name = te.getName(); } try { @@ -391,8 +393,9 @@ private void updateDirtyFlag() { final Runnable dirtyFlagUpdater = new Runnable() { @Override public void run() { - if (wordArea.getFrame().isDisposed()) + if (wordArea.getFrame().isDisposed()) { return; + } boolean dirty = wordArea.isDirty(); if (hasResultFile()) { try {