mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-04 22:23:28 +02:00
Bug 509798 - Use CElementHyperlinkDetector for assembly editors
Change-Id: Ie9bf16f00f8ae8c3f5cd1a51c441392fed4fc491
This commit is contained in:
parent
6cbac5a454
commit
f247b3141c
2 changed files with 13 additions and 4 deletions
|
@ -38,6 +38,7 @@ import org.eclipse.cdt.core.model.ICLanguageKeywords;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.ICModelBasedEditor;
|
||||||
import org.eclipse.cdt.ui.text.ICPartitions;
|
import org.eclipse.cdt.ui.text.ICPartitions;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
|
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
|
||||||
|
@ -54,7 +55,7 @@ public class CElementHyperlinkDetector extends AbstractHyperlinkDetector {
|
||||||
@Override
|
@Override
|
||||||
public IHyperlink[] detectHyperlinks(final ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) {
|
public IHyperlink[] detectHyperlinks(final ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) {
|
||||||
ITextEditor textEditor= getAdapter(ITextEditor.class);
|
ITextEditor textEditor= getAdapter(ITextEditor.class);
|
||||||
if (region == null || !(textEditor instanceof CEditor))
|
if (region == null || !(textEditor instanceof ICModelBasedEditor))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
final IAction openAction= textEditor.getAction("OpenDeclarations"); //$NON-NLS-1$
|
final IAction openAction= textEditor.getAction("OpenDeclarations"); //$NON-NLS-1$
|
||||||
|
|
|
@ -12,8 +12,11 @@
|
||||||
package org.eclipse.cdt.ui.text;
|
package org.eclipse.cdt.ui.text;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue