1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 509798 - Use CElementHyperlinkDetector for assembly editors

Change-Id: Ie9bf16f00f8ae8c3f5cd1a51c441392fed4fc491
This commit is contained in:
Nathan Ridge 2016-12-31 03:31:26 -05:00
parent 6cbac5a454
commit f247b3141c
2 changed files with 13 additions and 4 deletions

View file

@ -38,6 +38,7 @@ import org.eclipse.cdt.core.model.ICLanguageKeywords;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.ICModelBasedEditor;
import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
@ -54,7 +55,7 @@ public class CElementHyperlinkDetector extends AbstractHyperlinkDetector {
@Override
public IHyperlink[] detectHyperlinks(final ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) {
ITextEditor textEditor= getAdapter(ITextEditor.class);
if (region == null || !(textEditor instanceof CEditor))
if (region == null || !(textEditor instanceof ICModelBasedEditor))
return null;
final IAction openAction= textEditor.getAction("OpenDeclarations"); //$NON-NLS-1$

View file

@ -12,8 +12,11 @@
package org.eclipse.cdt.ui.text;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.content.IContentType;
@ -377,6 +380,11 @@ public class AsmSourceViewerConfiguration extends TextSourceViewerConfiguration
}
};
}
}
@Override
protected Map<String, IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
Map<String, IAdaptable> targets= super.getHyperlinkDetectorTargets(sourceViewer);
targets.put("org.eclipse.cdt.ui.cCode", fTextEditor); //$NON-NLS-1$
return targets;
}
}