Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominic Guss2018-05-04 00:31:07 +0000
committerDominic Guss2018-05-07 22:23:17 +0000
commit4b32b72bf00561e6c615d264495165d81bc10dee (patch)
tree66ac6b0f5701968feb9b2fd51935e14aeb31ae30
parent1e8bfe0c6a852ffc430b2c5c5d06acc40d4fa2f6 (diff)
downloadorg.eclipse.osee-4b32b72bf00561e6c615d264495165d81bc10dee.tar.gz
org.eclipse.osee-4b32b72bf00561e6c615d264495165d81bc10dee.tar.xz
org.eclipse.osee-4b32b72bf00561e6c615d264495165d81bc10dee.zip
bug[ats_TW9302]: Can't open png file from OSEE in Windows 100.25.4.v201805091913-NR
Change-Id: I2a635267d036ddced8ff3958f06675ca2452d2c4 Signed-off-by: Dominic Guss <Dominic.Guss@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/OseeUiActivator.java19
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/NativeRenderer.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramFinder.java59
-rw-r--r--plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramImage.java2
4 files changed, 72 insertions, 11 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/OseeUiActivator.java b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/OseeUiActivator.java
index 3db044bb92e..f3859fb3e8e 100644
--- a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/OseeUiActivator.java
+++ b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/OseeUiActivator.java
@@ -26,6 +26,7 @@ import org.eclipse.osee.framework.core.data.OseeCodeVersion;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.PluginUtil;
+import org.eclipse.osee.framework.ui.swt.ProgramFinder;
import org.eclipse.swt.program.Program;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -52,7 +53,7 @@ public abstract class OseeUiActivator extends AbstractUIPlugin {
/**
* finds a resource in the plugin bundle and writes it out to the default persistent storage area as a regualar file
- *
+ *
* @return Return plugin file reference
*/
public File getPluginFile(String path) throws IOException {
@@ -102,7 +103,7 @@ public abstract class OseeUiActivator extends AbstractUIPlugin {
/**
* Returns the workspace instance.
- *
+ *
* @return the workspace instance
*/
public static IWorkspace getWorkspace() {
@@ -119,7 +120,7 @@ public abstract class OseeUiActivator extends AbstractUIPlugin {
/**
* Returns Returns the root resource of this workspace
- *
+ *
* @return the workspace root
*/
public static IWorkspaceRoot getWorkspaceRoot() {
@@ -138,7 +139,7 @@ public abstract class OseeUiActivator extends AbstractUIPlugin {
/**
* Checks that OSEE is connected to all necessary application services
- *
+ *
* @return Result.isFalse if not connected with getText() of problem
*/
public static Result areOSEEServicesAvailable() {
@@ -153,16 +154,16 @@ public abstract class OseeUiActivator extends AbstractUIPlugin {
return toReturn;
}
- public ImageDescriptor getImageDescriptorForProgram(String extenstion) {
- ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(extenstion);
+ public ImageDescriptor getImageDescriptorForProgram(String extension) {
+ ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(extension);
- if (imageDescriptor == null && extenstion != null) {
- Program program = Program.findProgram(extenstion);
+ if (imageDescriptor == null && extension != null) {
+ Program program = ProgramFinder.findProgram(extension);
if (program == null || program.getImageData() == null) {
// provide no image (i.e. leave null)
} else {
imageDescriptor = ImageDescriptor.createFromImageData(program.getImageData());
- getImageRegistry().put(extenstion, imageDescriptor);
+ getImageRegistry().put(extension, imageDescriptor);
}
}
return imageDescriptor;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/NativeRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/NativeRenderer.java
index 5b875dd8679..c6174d20742 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/NativeRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/NativeRenderer.java
@@ -32,6 +32,7 @@ import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
import org.eclipse.osee.framework.ui.skynet.MenuCmdDef;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.ProgramFinder;
import org.eclipse.swt.program.Program;
/**
@@ -89,7 +90,7 @@ public class NativeRenderer extends FileSystemRenderer {
@Override
public Program getAssociatedProgram(Artifact artifact) throws OseeCoreException {
String extension = getAssociatedExtension(artifact);
- Program program = Program.findProgram(extension);
+ Program program = ProgramFinder.findProgram(extension);
if (program == null) {
throw new OseeArgumentException("No program associated with the extension [%s] found on your local machine.",
extension);
diff --git a/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramFinder.java b/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramFinder.java
new file mode 100644
index 00000000000..e00fc6c93c6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramFinder.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.swt;
+
+import org.eclipse.swt.program.Program;
+
+/**
+ * Provides a temporary workaround for a Windows 10 or Eclipse bug where the new Windows 10 Photo viewer application is
+ * seemingly not included in a program list retrieved from the org.eclipse.swt.program findProgram() function. Since, by
+ * default, this new Photo viewing application is the default viewer in Windows 10, no application will be associated
+ * with all media types when otherwise utilizing this function. This class considers all applicable media types based on
+ * the given parameter extension, then associates the legacy Windows Photo Viewer application, which is still included
+ * with Windows 10 installations. See submitted bug at this link: https://bugs.eclipse.org/bugs/show_bug.cgi?id=534441
+ *
+ * @author Dominic Guss
+ */
+public class ProgramFinder {
+
+ private enum MediaExtensions {
+ png,
+ bmp,
+ tif,
+ tiff,
+ jpg,
+ jpeg,
+ gif;
+ }
+
+ private static boolean isMediaFile(String extension) {
+ try {
+ MediaExtensions.valueOf(extension);
+ return true;
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ }
+
+ public static Program findProgram(String extension) {
+ Program program = Program.findProgram(extension);
+ if (program == null && isMediaFile(extension)) {
+ Program[] programs = Program.getPrograms();
+ for (Program prog : programs) {
+ if (prog.getName().equals("Windows Media Photo")) {
+ program = prog;
+ break;
+ }
+ }
+ }
+ return program;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramImage.java b/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramImage.java
index 9aad8bbd0a2..54afac6906a 100644
--- a/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramImage.java
+++ b/plugins/org.eclipse.osee.framework.ui.swt/src/org/eclipse/osee/framework/ui/swt/ProgramImage.java
@@ -26,7 +26,7 @@ public class ProgramImage implements KeyedImage {
@Override
public ImageDescriptor createImageDescriptor() {
- Program program = Program.findProgram(extension);
+ Program program = ProgramFinder.findProgram(extension);
if (program == null || program.getImageData() == null) {
return null;
}

Back to the top