-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "JBIDE-20834 - Fix issues with styled label providers"
This reverts commit 3532eda.
- Loading branch information
Showing
6 changed files
with
101 additions
and
8 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
...openshift.common.ui/src/org/jboss/tools/openshift/internal/common/ui/utils/GTK3Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is 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: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
|
||
package org.jboss.tools.openshift.internal.common.ui.utils; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
import org.eclipse.core.runtime.Platform; | ||
|
||
/** | ||
* @author Snjezana Peco | ||
*/ | ||
public class GTK3Utils { | ||
|
||
private static final String ENV_SWT_GTK3 = "ENV_SWT_GTK3"; //$NON-NLS-1$ | ||
|
||
private GTK3Utils() { | ||
} | ||
|
||
public static boolean isRunning() { | ||
if (Platform.WS_GTK.equals(Platform.getWS())) { | ||
try { | ||
Class<?> clazz = Class.forName("org.eclipse.swt.internal.gtk.OS"); //$NON-NLS-1$ | ||
Field field = clazz.getDeclaredField("GTK3"); //$NON-NLS-1$ | ||
boolean gtk3 = field.getBoolean(field); | ||
return gtk3; | ||
} catch (ClassNotFoundException e) { | ||
return isGTK3Env(); | ||
} catch (NoSuchFieldException e) { | ||
return false; | ||
} catch (SecurityException e) { | ||
return isGTK3Env(); | ||
} catch (IllegalArgumentException e) { | ||
return isGTK3Env(); | ||
} catch (IllegalAccessException e) { | ||
return isGTK3Env(); | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
private static boolean isGTK3Env() { | ||
String gtk3 = System.getProperty(ENV_SWT_GTK3); | ||
if (gtk3 == null) { | ||
gtk3 = System.getenv(ENV_SWT_GTK3); | ||
} | ||
return !"0".equals(gtk3); //$NON-NLS-1$ | ||
} | ||
|
||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...boss/tools/openshift/internal/common/ui/viewer/GTK3WorkaroundStyledCellLabelProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is 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: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package org.jboss.tools.openshift.internal.common.ui.viewer; | ||
|
||
import org.eclipse.jface.viewers.StyledCellLabelProvider; | ||
import org.jboss.tools.openshift.internal.common.ui.utils.GTK3Utils; | ||
|
||
/** | ||
* A styled cell labelprovider that works around gtk3 issues by disabling owner draw | ||
* | ||
* @author Andre Dietisheim | ||
* | ||
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=466499 | ||
* @see https://issues.jboss.org/browse/JBIDE-19853 | ||
* @see https://issues.jboss.org/browse/JBIDE-19932 | ||
*/ | ||
public abstract class GTK3WorkaroundStyledCellLabelProvider extends StyledCellLabelProvider { | ||
|
||
protected GTK3WorkaroundStyledCellLabelProvider() { | ||
if (GTK3Utils.isRunning()) { | ||
setOwnerDrawEnabled(false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters