Java 类org.eclipse.xtext.resource.ILocationInFileProvider 实例源码

项目:xtext-extras    文件:TreeAppendable.java   
private static ILocationData createLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, EObject object, ILocationInFileProviderExtension.RegionDescription query, boolean skipEmpty) {
    ITextRegion textRegion = locationProvider instanceof ILocationInFileProviderExtension ? 
            ((ILocationInFileProviderExtension) locationProvider).getTextRegion(object, query) : locationProvider.getFullTextRegion(object);
    if (!(textRegion instanceof ITextRegionWithLineInformation)) {
        if (log.isDebugEnabled())
            log.debug("location provider returned text region without line information.", new Exception());
        if (textRegion != null)
            textRegion = new TextRegionWithLineInformation(textRegion.getOffset(), textRegion.getLength(), 0, 0);
        else
            return null;
    } 
    // usually we want to skip empty regions but if the root region is empty, we want to use it to store the path information along
    // with the empty offset / length pair
    if (skipEmpty && textRegion == ITextRegion.EMPTY_REGION) {
        return null;
    }
    ILocationData newData = createLocationData(converter, object, (ITextRegionWithLineInformation) textRegion);
    return newData;
}
项目:z80editor    文件:Z80InstructionHelpView.java   
private void loadCycleInfo(final int offset, final int length, XtextEditor editor, final IDocument doc) {
    final ILocationInFileProvider locationInFileProvider = Z80Activator.getInstance().getInjector(Z80Activator.ORG_EFRY_Z80EDITOR_Z80).getInstance(ILocationInFileProvider.class);

    editor.getDocument().readOnly(new IUnitOfWork<Boolean, XtextResource>() {

        @Override
        public Boolean exec(XtextResource state) throws Exception {
            Z80OperationTypeWalker operationInstructions = new Z80OperationTypeWalker(state, locationInFileProvider, offset, offset + length);

            Z80CycleCalculator calc = new Z80CycleCalculator();

            for (Operation o : operationInstructions) {
                ITextRegion region = locationInFileProvider.getFullTextRegion(o);
                calc.addOperation(o, doc.get(region.getOffset(), region.getLength()));
            }
            label.setText(calc.getHtmlFormattedText());
            return Boolean.TRUE;
        }
    });
}
项目:xtext-extras    文件:TreeAppendable.java   
public TreeAppendable(ImportManager importManager, ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject source,
        String indentation, String lineSeparator) {
    this(
            new SharedAppendableState(indentation, lineSeparator, importManager, source.eResource()),
            converter,
            locationProvider,
            jvmModelAssociations,
            source);
}
项目:xtext-extras    文件:TreeAppendable.java   
protected TreeAppendable(SharedAppendableState state, ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject source) {
    this(
            state,
            converter,
            locationProvider,
            jvmModelAssociations,
            createAllLocationData(
                    converter,
                    locationProvider,
                    jvmModelAssociations,
                    source,
                    ILocationInFileProviderExtension.RegionDescription.INCLUDING_COMMENTS,
                    false), // don't skip empty root regions
            false);
}
项目:xtext-extras    文件:TreeAppendable.java   
protected TreeAppendable(SharedAppendableState state,
        final ITraceURIConverter converter,
        ILocationInFileProvider locationProvider,
        IJvmModelAssociations jvmModelAssociations,
        Set<ILocationData> sourceLocations, 
        boolean useForDebugging) {
    this.state = state;
    this.traceURIConverter = converter;
    this.locationProvider = locationProvider;
    this.jvmModelAssociations = jvmModelAssociations;
    this.children = Lists.newArrayList();
    this.locationData = sourceLocations;
    this.useForDebugging = useForDebugging;
    this.lightweightTypeReferenceSerializer = createLightweightTypeReferenceSerializer();
}
项目:xtext-extras    文件:ErrorTreeAppendable.java   
public ErrorTreeAppendable(SharedAppendableState state, 
        ITraceURIConverter converter,
        ILocationInFileProvider locationProvider,
        IJvmModelAssociations jvmModelAssociations,
        Set<ILocationData> sourceLocations, 
        boolean useForDebugging) {
    super(state, converter, locationProvider, jvmModelAssociations, sourceLocations, useForDebugging);
    encoder = getOrCreateURIEncoder();
}
项目:xtext-extras    文件:TreeAppendableUtil.java   
public ITreeAppendable traceWithComments(final ITreeAppendable appendable, final EObject source) {
  ITreeAppendable _xifexpression = null;
  if ((appendable instanceof TreeAppendable)) {
    _xifexpression = ((TreeAppendable)appendable).trace(source, ILocationInFileProviderExtension.RegionDescription.INCLUDING_COMMENTS, false);
  } else {
    ITreeAppendable _xblockexpression = null;
    {
      ITextRegion _switchResult = null;
      final ILocationInFileProvider locationProvider = this.locationProvider;
      boolean _matched = false;
      if (locationProvider instanceof ILocationInFileProviderExtension) {
        _matched=true;
        _switchResult = ((ILocationInFileProviderExtension)this.locationProvider).getTextRegion(source, ILocationInFileProviderExtension.RegionDescription.INCLUDING_COMMENTS);
      }
      if (!_matched) {
        _switchResult = this.locationProvider.getFullTextRegion(source);
      }
      final ITextRegionWithLineInformation it = ((ITextRegionWithLineInformation) _switchResult);
      ITreeAppendable _xifexpression_1 = null;
      if (((it != null) && (it != ITextRegion.EMPTY_REGION))) {
        int _offset = it.getOffset();
        int _length = it.getLength();
        int _lineNumber = it.getLineNumber();
        int _endLineNumber = it.getEndLineNumber();
        LocationData _locationData = new LocationData(_offset, _length, _lineNumber, _endLineNumber, null);
        _xifexpression_1 = appendable.trace(_locationData);
      } else {
        _xifexpression_1 = appendable;
      }
      _xblockexpression = _xifexpression_1;
    }
    _xifexpression = _xblockexpression;
  }
  return _xifexpression;
}
项目:z80editor    文件:Z80InstructionHelpView.java   
private void loadHtmlOpcodeInfo(final int offset, final int length, XtextEditor editor) {
    final ILocationInFileProvider locationInFileProvider = Z80Activator.getInstance().getInjector(Z80Activator.ORG_EFRY_Z80EDITOR_Z80).getInstance(ILocationInFileProvider.class);

    editor.getDocument().readOnly(new IUnitOfWork<Boolean, XtextResource>() {

        @Override
        public Boolean exec(XtextResource state) throws Exception {
            Z80OperationTypeWalker operationInstructions = new Z80OperationTypeWalker(state, locationInFileProvider, offset, offset + length);

            Iterator<Operation> itr = operationInstructions.iterator();
            if (itr.hasNext()) {
                Operation o = itr.next();

                InputStream in = this.getClass().getClassLoader().getResourceAsStream("resources/z80opCodes/" + o.getOpcode() + ".html");
                if (in != null) {
                    InputStreamReader r = new InputStreamReader(in);
                    try {
                        String desc = CharStreams.toString(r);
                        r.close();
                        in.close();
                        label.setText("<h2>" + Z80OpCodes.valueOf(o).name() + ":&nbsp;" + Z80OpCodes.valueOf(o).getDescription() + "</h2>" + desc);
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
            return Boolean.TRUE;
        }
    });
}
项目:n4js    文件:N4JSUiModule.java   
/**
 * Bind the {@link ILocationInFileProvider} that is aware of derived elements.
 */
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return N4JSLocationInFileProvider.class;
}
项目:gw4e.project    文件:AbstractDSLPoliciesRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return JvmLocationInFileProvider.class;
}
项目:xtext-extras    文件:AbstractPureXbaseRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return JvmLocationInFileProvider.class;
}
项目:xtext-extras    文件:AbstractXbaseRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return XbaseLocationInFileProvider.class;
}
项目:xtext-extras    文件:AbstractXbaseWithAnnotationsRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return XbaseLocationInFileProvider.class;
}
项目:xtext-extras    文件:FeatureCallCompiler.java   
protected ILocationInFileProvider getLocationInFileProvider() {
    return locationInFileProvider;
}
项目:xtext-extras    文件:TreeAppendable.java   
/**
 * @since 2.4
 */
protected TreeAppendable createChild(SharedAppendableState state, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, Set<ILocationData> newData, boolean useForDebugging) {
    return new TreeAppendable(state, traceURIConverter, locationProvider, jvmModelAssociations, newData, useForDebugging);
}
项目:xtext-extras    文件:TreeAppendable.java   
protected static ILocationData createLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, EObject object, ILocationInFileProviderExtension.RegionDescription query) {
    return createLocationData(converter, locationProvider, object, query, true);
}
项目:xtext-extras    文件:TreeAppendable.java   
private static Set<ILocationData> createAllLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject object, ILocationInFileProviderExtension.RegionDescription query) {
    return createAllLocationData(converter, locationProvider, jvmModelAssociations, object, query, true);
}
项目:xtext-extras    文件:ErrorTreeAppendable.java   
@Override
protected TreeAppendable createChild(SharedAppendableState state, ILocationInFileProvider locationProvider, 
        IJvmModelAssociations jvmModelAssociations, Set<ILocationData> newData, boolean useForDebugging) {
    return this;
}
项目:xtext-extras    文件:XbaseGeneratorFragment.java   
@Override
public Set<Binding> getGuiceBindingsRt(Grammar grammar) {
    if (!usesXbaseGrammar(grammar))
        return emptySet();
    BindFactory config = new BindFactory()

            // overrides binding from org.eclipse.xtext.generator.exporting.QualifiedNamesFragment
            .addTypeToType(IQualifiedNameProvider.class.getName(),
                            "org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider");

    if (useInferredJvmModel) {
        config = config
                .addTypeToType(ILocationInFileProvider.class.getName(),
                        "org.eclipse.xtext.xbase.jvmmodel.JvmLocationInFileProvider")
                .addTypeToType(IGlobalScopeProvider.class.getName(),
                        "org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")
                .addTypeToType("org.eclipse.xtext.xbase.validation.FeatureNameValidator",
                        "org.eclipse.xtext.xbase.validation.LogicalContainerAwareFeatureNameValidator")
                .addTypeToType("org.eclipse.xtext.xbase.typesystem.internal.DefaultBatchTypeResolver",
                        "org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareBatchTypeResolver")
                .addTypeToType("org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver",
                        "org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareReentrantTypeResolver")
                .addTypeToType(IResourceValidator.class.getCanonicalName(), 
                        "org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator");
        if(generateXtendInferrer) {
            config = config
                .addTypeToType("org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer",
                    getJvmModelInferrerName(grammar, getNaming()));
        }
    } else {
        config = config
                .addTypeToType(ILocationInFileProvider.class.getName(),
                            "org.eclipse.xtext.xbase.resource.XbaseLocationInFileProvider");

    }
    if (usesXImportSection(grammar)) {
        config = config.addConfiguredBinding(
                IScopeProvider.class.getName() + "Delegate",
                "binder.bind("
                        + IScopeProvider.class.getName()
                        + ".class).annotatedWith(com.google.inject.name.Names.named("
                        + AbstractDeclarativeScopeProvider.class.getName()
                        + ".NAMED_DELEGATE)).to("+ getImportScopeProvider(grammar)+")");
    }
    return config.getBindings();
}
项目:xtext-extras    文件:AbstractBug462047LangRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return JvmLocationInFileProvider.class;
}
项目:xtext-extras    文件:AbstractXImportSectionTestLangRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return JvmLocationInFileProvider.class;
}
项目:xtext-extras    文件:AbstractContentAssistFragmentTestLangRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return JvmLocationInFileProvider.class;
}
项目:xtext-core    文件:DefaultRuntimeModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return DefaultLocationInFileProvider.class;
}
项目:xtext-core    文件:XtextRuntimeModule.java   
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return XtextLocationInFileProvider.class;
}
项目:xtext-core    文件:XbaseGeneratorFragment2.java   
protected void contributeRuntimeGuiceBindings() {
  final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(IQualifiedNameProvider.class), 
    TypeReference.typeRef("org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider"));
  boolean _usesXImportSection = this._xbaseUsageDetector.usesXImportSection(this.getGrammar());
  boolean _not = (!_usesXImportSection);
  if (_not) {
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        _builder.append("binder.bind(");
        _builder.append(Boolean.class);
        _builder.append(".TYPE)");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append(".annotatedWith(");
        _builder.append(Names.class, "\t");
        _builder.append(".named(");
        TypeReference _typeReference = new TypeReference("org.eclipse.xtext.xbase.imports", "RewritableImportSection.Factory");
        _builder.append(_typeReference, "\t");
        _builder.append(".REWRITABLEIMPORTSECTION_ENABLEMENT))");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append(".toInstance(");
        _builder.append(Boolean.class, "\t");
        _builder.append(".FALSE);");
        _builder.newLineIfNotEmpty();
      }
    };
    bindingFactory.addConfiguredBinding("RewritableImportSectionEnablement", _client);
  }
  if (this.useInferredJvmModel) {
    bindingFactory.addTypeToType(TypeReference.typeRef(ILocationInFileProvider.class), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.JvmLocationInFileProvider")).addTypeToType(TypeReference.typeRef(IGlobalScopeProvider.class), 
      TypeReference.typeRef("org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.validation.FeatureNameValidator"), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.validation.LogicalContainerAwareFeatureNameValidator")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultBatchTypeResolver"), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareBatchTypeResolver")).addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver"), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareReentrantTypeResolver")).addTypeToType(TypeReference.typeRef(IResourceValidator.class), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.validation.DerivedStateAwareResourceValidator"));
    if (this.generateXtendInferrer) {
      bindingFactory.addTypeToType(TypeReference.typeRef("org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer"), this.getJvmModelInferrer());
    }
  } else {
    bindingFactory.addTypeToType(TypeReference.typeRef(ILocationInFileProvider.class), 
      TypeReference.typeRef("org.eclipse.xtext.xbase.resource.XbaseLocationInFileProvider"));
  }
  bindingFactory.contributeTo(this.getLanguage().getRuntimeGenModule());
  boolean _inheritsXbaseWithAnnotations = this._xbaseUsageDetector.inheritsXbaseWithAnnotations(this.getLanguage().getGrammar());
  if (_inheritsXbaseWithAnnotations) {
    GuiceModuleAccess _runtimeGenModule = this.getLanguage().getRuntimeGenModule();
    _runtimeGenModule.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.annotations.DefaultXbaseWithAnnotationsRuntimeModule"));
  } else {
    GuiceModuleAccess _runtimeGenModule_1 = this.getLanguage().getRuntimeGenModule();
    _runtimeGenModule_1.setSuperClass(TypeReference.typeRef("org.eclipse.xtext.xbase.DefaultXbaseRuntimeModule"));
  }
}
项目:dsl-devkit    文件:ScopeRuntimeModule.java   
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
  return ScopeLocationInFileProvider.class;
}
项目:dsl-devkit    文件:CheckRuntimeModule.java   
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
  return CheckLocationInFileProvider.class;
}
项目:dsl-devkit    文件:AbstractOutlineTreeProvider.java   
public ILocationInFileProvider getLocationInFileProvider() {
  return locationInFileProvider;
}
项目:z80editor    文件:Z80OperationTypeWalker.java   
public Z80OperationTypeWalker(XtextResource resource, ILocationInFileProvider l, int startOffset, int endOffset) {
    this.resource = resource;
    this.locationInFileProvider = l;
    this.startOffset = startOffset;
    this.endOffset = endOffset;
}
项目:z80editor    文件:Z80OperationTypeWalker.java   
public OperationSelectionIterator(XtextResource resource, ILocationInFileProvider locationInFileProvider, int startOffset, int endOffset) {
    this.resource = resource;
    this.locationInFileProvider = locationInFileProvider;
    this.startOffset = startOffset;
    this.endOffset = endOffset;
}
项目:bts    文件:EgyDslUiModule.java   
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
    return BTSLocationInFileProvider.class;
}
项目:bts    文件:DefaultOutlineTreeProvider.java   
/**
 * For testing.
 */
public DefaultOutlineTreeProvider(ILabelProvider labelProvider, ILocationInFileProvider locationInFileProvider) {
    this.labelProvider = labelProvider;
    this.locationInFileProvider = locationInFileProvider;
}
项目:bts    文件:OutlineNodeFactory.java   
protected ILocationInFileProvider getLocationInFileProvider() {
    return locationInFileProvider;
}
项目:bts    文件:DefaultFoldingRegionProvider.java   
@Deprecated
public DefaultFoldingRegionProvider(ILocationInFileProvider locationInFileProvider) {
    this.locationInFileProvider = locationInFileProvider;
    this.tokenTypeToPartitionTypeMapperExtension = new TerminalsTokenTypeToPartitionMapper();
}
项目:bts    文件:DefaultFoldingRegionProvider.java   
protected ILocationInFileProvider getLocationInFileProvider() {
    return locationInFileProvider;
}
项目:bts    文件:LanguageSpecificURIEditorOpener.java   
public void setLocationProvider(ILocationInFileProvider locationProvider) {
    this.locationProvider = locationProvider;
}
项目:bts    文件:LanguageSpecificURIEditorOpener.java   
public ILocationInFileProvider getLocationProvider() {
    return locationProvider;
}
项目:bts    文件:DefaultReferenceUpdater.java   
protected ILocationInFileProvider getLocationInFileProvider() {
    return locationInFileProvider;
}
项目:dsl-devkit    文件:CheckCfgRuntimeModule.java   
/**
 * Custom location in file provider used for revealing and highlighting a model element in the editor.
 * <p>
 * {@inheritDoc}
 */
@Override
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
  return CheckCfgLocationInFileProvider.class;
}