Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-10-24 16:14:02 +0000
committerUwe Stieber2012-10-24 16:14:02 +0000
commit42e87211637702ad9d62c5e67b4cf0e80f0736f9 (patch)
treef6b4a2e6f65b7f16c6d48ab1fc8c4256b17335e0 /target_explorer
parent6cca312d1ce090d5c34966cf89b9a5640402e565 (diff)
downloadorg.eclipse.tcf-42e87211637702ad9d62c5e67b4cf0e80f0736f9.tar.gz
org.eclipse.tcf-42e87211637702ad9d62c5e67b4cf0e80f0736f9.tar.xz
org.eclipse.tcf-42e87211637702ad9d62c5e67b4cf0e80f0736f9.zip
Target Explorer: Fix NPE
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/quickfilter/EditorQuickFilterTester.java128
1 files changed, 64 insertions, 64 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/quickfilter/EditorQuickFilterTester.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/quickfilter/EditorQuickFilterTester.java
index 94d0e82e2..f1d359df6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/quickfilter/EditorQuickFilterTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/quickfilter/EditorQuickFilterTester.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.views.internal.quickfilter;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.tcf.te.core.interfaces.IFilterable;
-import org.eclipse.tcf.te.ui.views.editor.Editor;
-import org.eclipse.ui.forms.editor.IFormPage;
-
-/**
- * The tester to test if the current editor page is filterable.
- *
- */
-public class EditorQuickFilterTester extends PropertyTester {
-
- public EditorQuickFilterTester() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- @Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof Editor && "isEditorFilterable".equals(property)) { //$NON-NLS-1$
- Editor editor = (Editor) receiver;
- IFormPage page = editor.getActivePageInstance();
- if (page != null) {
- TreeViewer viewer = (TreeViewer) page.getAdapter(TreeViewer.class);
- if (viewer != null) {
- Object input = viewer.getInput();
- return adaptFilterable(input) != null;
- }
- }
- }
- return false;
- }
-
- private IFilterable adaptFilterable(Object element) {
- IFilterable decorator = null;
- if (element instanceof IFilterable) {
- decorator = (IFilterable) element;
- }
- if (decorator == null && element instanceof IAdaptable) {
- decorator = (IFilterable) ((IAdaptable) element).getAdapter(IFilterable.class);
- }
- if (decorator == null) {
- decorator = (IFilterable) Platform.getAdapterManager()
- .getAdapter(element, IFilterable.class);
- }
- return decorator;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. and others. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.internal.quickfilter;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.tcf.te.core.interfaces.IFilterable;
+import org.eclipse.tcf.te.ui.views.editor.Editor;
+import org.eclipse.ui.forms.editor.IFormPage;
+
+/**
+ * The tester to test if the current editor page is filterable.
+ *
+ */
+public class EditorQuickFilterTester extends PropertyTester {
+
+ public EditorQuickFilterTester() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (receiver instanceof Editor && "isEditorFilterable".equals(property)) { //$NON-NLS-1$
+ Editor editor = (Editor) receiver;
+ IFormPage page = editor.getActivePageInstance();
+ if (page != null) {
+ TreeViewer viewer = (TreeViewer) page.getAdapter(TreeViewer.class);
+ if (viewer != null) {
+ Object input = viewer.getInput();
+ return adaptFilterable(input) != null;
+ }
+ }
+ }
+ return false;
+ }
+
+ private IFilterable adaptFilterable(Object element) {
+ IFilterable decorator = null;
+ if (element instanceof IFilterable) {
+ decorator = (IFilterable) element;
+ }
+ if (decorator == null && element instanceof IAdaptable) {
+ decorator = (IFilterable) ((IAdaptable) element).getAdapter(IFilterable.class);
+ }
+ if (decorator == null && element != null) {
+ decorator = (IFilterable) Platform.getAdapterManager()
+ .getAdapter(element, IFilterable.class);
+ }
+ return decorator;
+ }
+
+}

Back to the top