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 @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion team/bundles/org.eclipse.compare.win32/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<relativePath>../../</relativePath>
</parent>
<artifactId>org.eclipse.compare.win32</artifactId>
<version>1.3.500-SNAPSHOT</version>
<version>1.3.600-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

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

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

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

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