Search in sources :

Example 1 with Decision

use of org.eclipse.xtext.xbase.ui.editor.StacktraceBasedEditorDecider.Decision in project xtext-eclipse by eclipse.

the class OriginalEditorSelector method findXbaseEditor.

public IEditorDescriptor findXbaseEditor(IEditorInput editorInput, boolean ignorePreference) {
    IFile file = ResourceUtil.getFile(editorInput);
    if (file == null)
        return null;
    if (!ignorePreference) {
        if (file.exists()) {
            try {
                String favoriteEditor = file.getPersistentProperty(IDE.EDITOR_KEY);
                if (favoriteEditor != null)
                    return null;
            } catch (CoreException e) {
                logger.debug(e.getMessage(), e);
            }
        }
    }
    // TODO stay in same editor if local navigation
    Decision decision = decisions.decideAccordingToCaller();
    if (decision == Decision.FORCE_JAVA) {
        return null;
    }
    IEclipseTrace traceToSource = traceInformation.getTraceToSource(file);
    return getXtextEditor(traceToSource);
}
Also used : IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) IEclipseTrace(org.eclipse.xtext.ui.generator.trace.IEclipseTrace) Decision(org.eclipse.xtext.xbase.ui.editor.StacktraceBasedEditorDecider.Decision)

Aggregations

IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 IEclipseTrace (org.eclipse.xtext.ui.generator.trace.IEclipseTrace)1 Decision (org.eclipse.xtext.xbase.ui.editor.StacktraceBasedEditorDecider.Decision)1