diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index adf2b468f0f..d90fbcd062b 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -3488,8 +3488,11 @@
name="%CDTLanguagesProperty.name">
+
+
+
-
@@ -5010,5 +5013,15 @@
+
+
+
+
+
+
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ResourceToCElementAdapterFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ResourceToCElementAdapterFactory.java
new file mode 100644
index 00000000000..638dfa2ac45
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ResourceToCElementAdapterFactory.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Ericsson.
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.cdt.internal.ui;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdapterFactory;
+
+import org.eclipse.cdt.core.model.CoreModelUtil;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+
+
+/**
+ * An adapter factory that adapts resources to CElements. This was introduced in
+ * the context of non-extensible content providers (Package Explorer) which
+ * contain plain resources and not CElements. This allows some contributions to
+ * work without explicitly depending the content provider in order to extend it.
+ */
+public class ResourceToCElementAdapterFactory implements IAdapterFactory {
+
+ private static final Class>[] ADAPTER_LIST = new Class>[] { ITranslationUnit.class };
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public T getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IFile && adapterType.equals(ITranslationUnit.class)) {
+ return (T) CoreModelUtil.findTranslationUnit((IFile) adaptableObject);
+ }
+ return null;
+ }
+
+ @Override
+ public Class>[] getAdapterList() {
+ return ADAPTER_LIST;
+ }
+}