Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-10-24 16:27:07 +0000
committerUwe Stieber2012-10-24 16:27:07 +0000
commitcad4ea8c233c651d29a8fb64bd1296a26152b767 (patch)
tree6e9976187b477e310f69eae976f62af644ddab47 /target_explorer/plugins
parentee4a0e42ee6c06878755d1b3b4ccccfc8f0d0c7f (diff)
downloadorg.eclipse.tcf-cad4ea8c233c651d29a8fb64bd1296a26152b767.tar.gz
org.eclipse.tcf-cad4ea8c233c651d29a8fb64bd1296a26152b767.tar.xz
org.eclipse.tcf-cad4ea8c233c651d29a8fb64bd1296a26152b767.zip
Target Explorer: Fix NPE
Diffstat (limited to 'target_explorer/plugins')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java137
1 files changed, 71 insertions, 66 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
index ed76450c4..c23c01bbd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
@@ -1,66 +1,71 @@
-/*******************************************************************************
- * 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.tcf.filesystem.ui.internal.pages;
-
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
-import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
-/**
- * The editor page for the file system explorer.
- */
-public class FSExplorerEditorPage extends TreeViewerExplorerEditorPage {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getDoubleClickCommandId()
- */
- @Override
- protected String getDoubleClickCommandId() {
- return "org.eclipse.ui.navigator.Open"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerId()
- */
- @Override
- protected String getViewerId() {
- return "org.eclipse.tcf.te.ui.controls.viewer.fs"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
- */
- @Override
- protected String getFormTitle() {
- return Messages.FSExplorerEditorPage_PageTitle;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
- */
- @Override
- protected String getContextHelpId() {
- return "org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerInput()
- */
- @Override
- protected Object getViewerInput() {
- IPeerModel peerModel = (IPeerModel) getEditorInputNode();
- return FSModel.getFSModel(peerModel).getRoot();
- }
-}
+/*******************************************************************************
+ * 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.tcf.filesystem.ui.internal.pages;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
+/**
+ * The editor page for the file system explorer.
+ */
+public class FSExplorerEditorPage extends TreeViewerExplorerEditorPage {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getDoubleClickCommandId()
+ */
+ @Override
+ protected String getDoubleClickCommandId() {
+ return "org.eclipse.ui.navigator.Open"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerId()
+ */
+ @Override
+ protected String getViewerId() {
+ return "org.eclipse.tcf.te.ui.controls.viewer.fs"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
+ */
+ @Override
+ protected String getFormTitle() {
+ return Messages.FSExplorerEditorPage_PageTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
+ */
+ @Override
+ protected String getContextHelpId() {
+ return "org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerInput()
+ */
+ @Override
+ protected Object getViewerInput() {
+ Object element = getEditorInputNode();
+ IPeerModel peerModel = element instanceof IPeerModel ? (IPeerModel)element : null;
+ if (peerModel == null && element instanceof IAdaptable) {
+ peerModel = (IPeerModel)((IAdaptable)element).getAdapter(IPeerModel.class);
+ }
+ return peerModel != null ? FSModel.getFSModel(peerModel).getRoot() : null;
+ }
+}

Back to the top