Java 类org.eclipse.jface.text.source.projection.ProjectionViewer 实例源码

项目:iTrace-Archive    文件:AstManager.java   
/**
 * Constructor. Loads the AST and sets up the StyledText to automatically
 * reload after certain events.
 * @param editor IEditorPart which owns the following StyledText.
 * @param styledText StyledText to which this AST pertains.
 */
public AstManager(IEditorPart editor, StyledText styledText) {
    try {
        editorPath = ((IFileEditorInput) editor.getEditorInput()).getFile()
                .getFullPath().toFile().getCanonicalPath();
    } catch (IOException e) {
        // ignore IOErrors while constructing path
        editorPath = "?";
    }
    this.editor = editor;
    this.styledText = styledText;
    //This is the only why I know to get the ProjectionViewer. Perhaps there is better way. ~Ben
    ITextOperationTarget t = (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
    if(t instanceof ProjectionViewer) projectionViewer = (ProjectionViewer)t;
    hookupAutoReload();
    reload();
}
项目:iTrace-Archive    文件:ITrace.java   
public void showTokenHighLights(){
    showTokenHighlights = !showTokenHighlights;
    if(activeEditor == null) return;
if(!tokenHighlighters.containsKey(activeEditor)){
    StyledText styledText = (StyledText) activeEditor.getAdapter(Control.class);
    if(styledText != null){
        ITextOperationTarget t = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
        if(t instanceof ProjectionViewer){
            ProjectionViewer projectionViewer = (ProjectionViewer)t;
            tokenHighlighters.put(activeEditor, new TokenHighlighter(styledText, showTokenHighlights, projectionViewer));
        }
    }
}
    for(TokenHighlighter tokenHighlighter: tokenHighlighters.values()){
        tokenHighlighter.setShow(showTokenHighlights);
    }
  }
项目:DarwinSPL    文件:DwprofileEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("de.darwinspl.preferences.resource.dwprofile.EditorScope");
}
项目:DarwinSPL    文件:DwprofileHighlighting.java   
/**
 * <p>
 * Creates the highlighting manager class.
 * </p>
 * 
 * @param textResource the text resource to be provided to other classes
 * @param sourceviewer the source viewer converts offset between master and slave
 * documents
 * @param colorManager the color manager provides highlighting colors
 * @param editor the editor that uses this highlighting object
 */
public DwprofileHighlighting(de.darwinspl.preferences.resource.dwprofile.IDwprofileTextResource textResource, ProjectionViewer projectionViewer, de.darwinspl.preferences.resource.dwprofile.ui.DwprofileColorManager colorManager, de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor editor) {
    this.display = Display.getCurrent();
    projectionViewer.getSelectionProvider();
    this.preferenceStore = de.darwinspl.preferences.resource.dwprofile.ui.DwprofileUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    this.textWidget = projectionViewer.getTextWidget();
    this.projectionViewer = projectionViewer;
    this.occurrence = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileOccurrence(textResource, projectionViewer);
    this.bracketSet = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileBracketSet();
    this.colorManager = colorManager;
    this.isHighlightBrackets = preferenceStore.getBoolean(de.darwinspl.preferences.resource.dwprofile.ui.DwprofilePreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX);
    this.bracketColor = colorManager.getColor(PreferenceConverter.getColor(preferenceStore, de.darwinspl.preferences.resource.dwprofile.ui.DwprofilePreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
    this.black = colorManager.getColor(new RGB(0, 0, 0));

    addListeners(editor);
}
项目:DarwinSPL    文件:HyexpressionHighlighting.java   
/**
 * <p>
 * Creates the highlighting manager class.
 * </p>
 * 
 * @param textResource the text resource to be provided to other classes
 * @param sourceviewer the source viewer converts offset between master and slave
 * documents
 * @param colorManager the color manager provides highlighting colors
 * @param editor the editor that uses this highlighting object
 */
public HyexpressionHighlighting(eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionTextResource textResource, ProjectionViewer projectionViewer, eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionColorManager colorManager, eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor editor) {
    this.display = Display.getCurrent();
    projectionViewer.getSelectionProvider();
    this.preferenceStore = eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    this.textWidget = projectionViewer.getTextWidget();
    this.projectionViewer = projectionViewer;
    this.occurrence = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionOccurrence(textResource, projectionViewer);
    this.bracketSet = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionBracketSet();
    this.colorManager = colorManager;
    this.isHighlightBrackets = preferenceStore.getBoolean(eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionPreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX);
    this.bracketColor = colorManager.getColor(PreferenceConverter.getColor(preferenceStore, eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
    this.black = colorManager.getColor(new RGB(0, 0, 0));

    addListeners(editor);
}
项目:DarwinSPL    文件:HyexpressionEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.feature.expression.resource.hyexpression.EditorScope");
}
项目:DarwinSPL    文件:HyvalidityformulaHighlighting.java   
/**
 * <p>
 * Creates the highlighting manager class.
 * </p>
 * 
 * @param textResource the text resource to be provided to other classes
 * @param sourceviewer the source viewer converts offset between master and slave
 * documents
 * @param colorManager the color manager provides highlighting colors
 * @param editor the editor that uses this highlighting object
 */
public HyvalidityformulaHighlighting(eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaTextResource textResource, ProjectionViewer projectionViewer, eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaColorManager colorManager, eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor editor) {
    this.display = Display.getCurrent();
    projectionViewer.getSelectionProvider();
    this.preferenceStore = eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    this.textWidget = projectionViewer.getTextWidget();
    this.projectionViewer = projectionViewer;
    this.occurrence = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaOccurrence(textResource, projectionViewer);
    this.bracketSet = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaBracketSet();
    this.colorManager = colorManager;
    this.isHighlightBrackets = preferenceStore.getBoolean(eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaPreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX);
    this.bracketColor = colorManager.getColor(PreferenceConverter.getColor(preferenceStore, eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
    this.black = colorManager.getColor(new RGB(0, 0, 0));

    addListeners(editor);
}
项目:DarwinSPL    文件:HyvalidityformulaEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.context.contextValidity.resource.hyvalidityformula.EditorScope");
}
项目:DarwinSPL    文件:HydatavalueHighlighting.java   
/**
 * <p>
 * Creates the highlighting manager class.
 * </p>
 * 
 * @param textResource the text resource to be provided to other classes
 * @param sourceviewer the source viewer converts offset between master and slave
 * documents
 * @param colorManager the color manager provides highlighting colors
 * @param editor the editor that uses this highlighting object
 */
public HydatavalueHighlighting(eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueTextResource textResource, ProjectionViewer projectionViewer, eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueColorManager colorManager, eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor editor) {
    this.display = Display.getCurrent();
    projectionViewer.getSelectionProvider();
    this.preferenceStore = eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    this.textWidget = projectionViewer.getTextWidget();
    this.projectionViewer = projectionViewer;
    this.occurrence = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueOccurrence(textResource, projectionViewer);
    this.bracketSet = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueBracketSet();
    this.colorManager = colorManager;
    this.isHighlightBrackets = preferenceStore.getBoolean(eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavaluePreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX);
    this.bracketColor = colorManager.getColor(PreferenceConverter.getColor(preferenceStore, eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavaluePreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
    this.black = colorManager.getColor(new RGB(0, 0, 0));

    addListeners(editor);
}
项目:DarwinSPL    文件:HydatavalueEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.dataValues.resource.hydatavalue.EditorScope");
}
项目:DarwinSPL    文件:HymappingHighlighting.java   
/**
 * <p>
 * Creates the highlighting manager class.
 * </p>
 * 
 * @param textResource the text resource to be provided to other classes
 * @param sourceviewer the source viewer converts offset between master and slave
 * documents
 * @param colorManager the color manager provides highlighting colors
 * @param editor the editor that uses this highlighting object
 */
public HymappingHighlighting(eu.hyvar.feature.mapping.resource.hymapping.IHymappingTextResource textResource, ProjectionViewer projectionViewer, eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingColorManager colorManager, eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor editor) {
    this.display = Display.getCurrent();
    projectionViewer.getSelectionProvider();
    this.preferenceStore = eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    this.textWidget = projectionViewer.getTextWidget();
    this.projectionViewer = projectionViewer;
    this.occurrence = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingOccurrence(textResource, projectionViewer);
    this.bracketSet = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingBracketSet();
    this.colorManager = colorManager;
    this.isHighlightBrackets = preferenceStore.getBoolean(eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingPreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX);
    this.bracketColor = colorManager.getColor(PreferenceConverter.getColor(preferenceStore, eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
    this.black = colorManager.getColor(new RGB(0, 0, 0));

    addListeners(editor);
}
项目:DarwinSPL    文件:HymappingEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.feature.mapping.resource.hymapping.EditorScope");
}
项目:DarwinSPL    文件:HyconstraintsEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.feature.constraint.resource.hyconstraints.EditorScope");
}
项目:DarwinSPL    文件:HyconstraintsHighlighting.java   
/**
 * <p>
 * Creates the highlighting manager class.
 * </p>
 * 
 * @param textResource the text resource to be provided to other classes
 * @param sourceviewer the source viewer converts offset between master and slave
 * documents
 * @param colorManager the color manager provides highlighting colors
 * @param editor the editor that uses this highlighting object
 */
public HyconstraintsHighlighting(eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsTextResource textResource, ProjectionViewer projectionViewer, eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsColorManager colorManager, eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor editor) {
    this.display = Display.getCurrent();
    projectionViewer.getSelectionProvider();
    this.preferenceStore = eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    this.textWidget = projectionViewer.getTextWidget();
    this.projectionViewer = projectionViewer;
    this.occurrence = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsOccurrence(textResource, projectionViewer);
    this.bracketSet = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsBracketSet();
    this.colorManager = colorManager;
    this.isHighlightBrackets = preferenceStore.getBoolean(eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsPreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX);
    this.bracketColor = colorManager.getColor(PreferenceConverter.getColor(preferenceStore, eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
    this.black = colorManager.getColor(new RGB(0, 0, 0));

    addListeners(editor);
}
项目:DarwinSPL    文件:HymanifestEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestHighlighting(getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext("eu.hyvar.mspl.manifest.resource.hymanifest.EditorScope");
}
项目:DarwinSPL    文件:HymanifestHighlighting.java   
/**
 * <p>
 * Creates the highlighting manager class.
 * </p>
 * 
 * @param textResource the text resource to be provided to other classes
 * @param sourceviewer the source viewer converts offset between master and slave
 * documents
 * @param colorManager the color manager provides highlighting colors
 * @param editor the editor that uses this highlighting object
 */
public HymanifestHighlighting(eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestTextResource textResource, ProjectionViewer projectionViewer, eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestColorManager colorManager, eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor editor) {
    this.display = Display.getCurrent();
    projectionViewer.getSelectionProvider();
    this.preferenceStore = eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestUIPlugin.getDefault().getPreferenceStore();
    this.editor = editor;
    this.textWidget = projectionViewer.getTextWidget();
    this.projectionViewer = projectionViewer;
    this.occurrence = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestOccurrence(textResource, projectionViewer);
    this.bracketSet = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestBracketSet();
    this.colorManager = colorManager;
    this.isHighlightBrackets = preferenceStore.getBoolean(eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestPreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX);
    this.bracketColor = colorManager.getColor(PreferenceConverter.getColor(preferenceStore, eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR));
    this.black = colorManager.getColor(new RGB(0, 0, 0));

    addListeners(editor);
}
项目:texlipse    文件:BibEditor.java   
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();

    fProjectionSupport = new ProjectionSupport(projectionViewer,
            getAnnotationAccess(), getSharedColors());
    fProjectionSupport
    .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
    fProjectionSupport
    .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
    fProjectionSupport.install();

    if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.BIB_CODE_FOLDING)) {
        projectionViewer.doOperation(ProjectionViewer.TOGGLE);
    }

    this.documentModel.update();
}
项目:typescript.java    文件:JavaScriptLightWeightEditor.java   
/**
 * Install everything necessary to get document folding working and enable
 * document folding
 * 
 * @param sourceViewer
 */
private void installProjectionSupport() {

    ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
    fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
    fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
    fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
    fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            return new DefaultInformationControl(parent);
        }
    });
    fProjectionSupport.install();

    if (isFoldingEnabled()) {
        projectionViewer.doOperation(ProjectionViewer.TOGGLE);
    }
}
项目:APICloud-Studio    文件:FoldingActionsGroup.java   
/**
 * Constructs a new FoldingActionsGroup with a given text editor.
 * 
 * @param textEditor
 */
public FoldingActionsGroup(ITextEditor textEditor)
{
    // Initialize the actions.
    collapseAction = new TextOperationAction(Messages.getResourceBundle(),
            "Folding.Collapse.", textEditor, ProjectionViewer.COLLAPSE, true); //$NON-NLS-1$
    collapseAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE);
    textEditor.setAction(IFoldingCommandIds.FOLDING_COLLAPSE, collapseAction);

    expandAction = new TextOperationAction(Messages.getResourceBundle(),
            "Folding.Expand.", textEditor, ProjectionViewer.EXPAND, true); //$NON-NLS-1$
    expandAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND);
    textEditor.setAction(IFoldingCommandIds.FOLDING_EXPAND, expandAction);

    collapseAllAction = new TextOperationAction(Messages.getResourceBundle(),
            "Folding.CollapseAll.", textEditor, ProjectionViewer.COLLAPSE_ALL, true); //$NON-NLS-1$
    collapseAllAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL);
    textEditor.setAction(IFoldingCommandIds.FOLDING_COLLAPSE_ALL, collapseAllAction);

    expandAllAction = new TextOperationAction(Messages.getResourceBundle(),
            "Folding.ExpandAll.", textEditor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$
    expandAllAction.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL);
    textEditor.setAction(IFoldingCommandIds.FOLDING_EXPAND_ALL, expandAllAction);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
@Override
protected void performRevert() {
    ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
    projectionViewer.setRedraw(false);
    try {

        boolean projectionMode= projectionViewer.isProjectionMode();
        if (projectionMode) {
            projectionViewer.disableProjection();
            if (fProjectionModelUpdater != null)
                fProjectionModelUpdater.uninstall();
        }

        super.performRevert();

        if (projectionMode) {
            if (fProjectionModelUpdater != null)
                fProjectionModelUpdater.install(this, projectionViewer);
            projectionViewer.enableProjection();
        }

    } finally {
        projectionViewer.setRedraw(true);
    }
}
项目:idecore    文件:ApexCodeEditor.java   
@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    ((ProjectionViewer) getSourceViewer()).enableProjection();

    editorSelectionChangedListener = new EditorSelectionChangedListener();
    editorSelectionChangedListener.install(getSelectionProvider());

    IPreferenceStore preferenceStore = getPreferenceStore();
    boolean closeBrackets = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACKETS);
    boolean closeStrings = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_STRINGS);
    boolean closeAngularBrackets = "1.5".compareTo(preferenceStore.getString(PreferenceConstants.COMPILER_SOURCE)) <= 0; // $NON-NLS-1$

    fBracketInserter.setCloseBracketsEnabled(closeBrackets);
    fBracketInserter.setCloseStringsEnabled(closeStrings);
    fBracketInserter.setCloseAngularBracketsEnabled(closeAngularBrackets);

    ISourceViewer sourceViewer = getSourceViewer();
    if (sourceViewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
}
项目:idecore    文件:ApexCodeEditor.java   
@Override
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    fAnnotationAccess = createAnnotationAccess();
    fOverviewRuler = createOverviewRuler(getSharedColors());
    ProjectionViewer viewer =
            new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);

    fProjectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    fProjectionSupport.addSummarizableAnnotationType(ANNOTATION_TYPE_APEX_ERROR); //$NON-NLS-1$
    fProjectionSupport.addSummarizableAnnotationType(ANNOTATION_TYPE_APEX_WARNING); //$NON-NLS-1$
    fProjectionSupport.install();
    setTitleToolTip(EDITOR_NAME);

    // ensure source viewer decoration support has been created and configured
    getSourceViewerDecorationSupport(viewer);

    fBracketInserter = new BracketInserter(this, viewer);
    return viewer;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
@Override
protected void performRevert() {
    ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
    projectionViewer.setRedraw(false);
    try {

        boolean projectionMode= projectionViewer.isProjectionMode();
        if (projectionMode) {
            projectionViewer.disableProjection();
            if (fProjectionModelUpdater != null)
                fProjectionModelUpdater.uninstall();
        }

        super.performRevert();

        if (projectionMode) {
            if (fProjectionModelUpdater != null)
                fProjectionModelUpdater.install(this, projectionViewer);
            projectionViewer.enableProjection();
        }

    } finally {
        projectionViewer.setRedraw(true);
    }
}
项目:birt    文件:DecoratedScriptEditor.java   
public void createPartControl( Composite parent )
{
    if ( input != null )
    {
        setInput( input );
    }
    super.createPartControl( parent );

    ISourceViewer viewer = getViewer( );

    if ( viewer instanceof ProjectionViewer )
    {
        // Turn projection mode on.
        ( (ProjectionViewer) viewer ).doOperation( ProjectionViewer.TOGGLE );
    }
    // bidi_hcg: Force LTR orientation of the StyledText widget
    getSourceViewer( ).getTextWidget( ).setOrientation( SWT.LEFT_TO_RIGHT );
}
项目:birt    文件:DecoratedScriptEditor.java   
protected ISourceViewer createSourceViewer( Composite parent,
        IVerticalRuler ruler, int styles )
{
    fAnnotationAccess = getAnnotationAccess( );
    fOverviewRuler = createOverviewRuler( getSharedColors( ) );

    ProjectionViewer viewer = new ProjectionViewer( parent,
            ruler,
            getOverviewRuler( ),
            isOverviewRulerVisible( ),
            styles );

    ProjectionSupport fProjectionSupport = new ProjectionSupport( viewer,
            getAnnotationAccess( ),
            getSharedColors( ) );
    fProjectionSupport.addSummarizableAnnotationType( "org.eclipse.ui.workbench.texteditor.error" ); //$NON-NLS-1$
    fProjectionSupport.addSummarizableAnnotationType( "org.eclipse.ui.workbench.texteditor.warning" ); //$NON-NLS-1$
    fProjectionSupport.install( );

    // Ensures source viewer decoration support has been created and
    // configured.
    getSourceViewerDecorationSupport( viewer );

    return viewer;
}
项目:wt-studio    文件:JsonTextEditor.java   
@Override
public void createPartControl(Composite parent) {
    JsonPreferenceStore jsonPreferenceStore = JsonPreferenceStore.getJsonPreferenceStore();
    viewerConfiguration = new JsonSourceViewerConfiguration(this, jsonPreferenceStore);
    setSourceViewerConfiguration(viewerConfiguration);
    super.createPartControl(parent);

    ProjectionViewer viewer =(ProjectionViewer) getSourceViewer();
    projectionSupport = new ProjectionSupport(viewer,getAnnotationAccess(),getSharedColors());
    projectionSupport.install();

    //turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);

    annotationModel = viewer.getProjectionAnnotationModel();

    SourceViewerDecorationSupport support = getSourceViewerDecorationSupport(viewer);
    support.install(getPreferenceStore());


    IFile file = (IFile) getEditorInput().getAdapter(IFile.class);
    platformPreferenceListener = new PlatformPreferenceListener(viewerConfiguration, jsonPreferenceStore);
    platformPreferenceListener.setPreferenceChangeListener(file);
}
项目:e4macs    文件:RepositionHandler.java   
/**
 * A semi-hack... This uses stuff that may change at any time in Eclipse.  
 * In the java editor, the projection annotation model contains the collapsible regions which correspond to methods (and other areas
 * such as import groups).
 * 
 * This may work in other editor types as well... TBD
 */
protected int transform(ITextEditor editor, IDocument document, ITextSelection currentSelection,
        ExecutionEvent event) throws BadLocationException {

    ITextViewerExtension viewer = MarkUtils.getITextViewer(editor);
    if (viewer instanceof ProjectionViewer) {
        ProjectionAnnotationModel projection = ((ProjectionViewer)viewer).getProjectionAnnotationModel();
        @SuppressWarnings("unchecked") // the method name says it all
        Iterator<Annotation> pit = projection.getAnnotationIterator();
        while (pit.hasNext()) {
            Position p = projection.getPosition(pit.next());
            if (p.includes(currentSelection.getOffset())) {
                if (isUniversalPresent()) {
                    // Do this here to prevent subsequent scrolling once range is revealed
                    MarkUtils.setSelection(editor, new TextSelection(document, p.offset, 0));
                }
                // the viewer is pretty much guaranteed to be a TextViewer
                if (viewer instanceof TextViewer) {
                    ((TextViewer)viewer).revealRange(p.offset, p.length);
                }
                break;
            }
        }
    }
    return NO_OFFSET;       
}
项目:Pydev    文件:PyEditProjection.java   
@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    try {
        ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();

        fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
        fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
        fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
        fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {
            @Override
            public IInformationControl createInformationControl(Shell shell) {
                return new DefaultInformationControl(shell);
            }
        });
        fProjectionSupport.install();

        if (isFoldingEnabled()) {
            projectionViewer.doOperation(ProjectionViewer.TOGGLE);
        }
    } catch (Exception e) {
        Log.log(e);
    }
}
项目:dLabPro-Plugin    文件:AbstractEditor.java   
public void doFolding(int nMode)
{
  ProjectionViewer iPv = (ProjectionViewer)getSourceViewer();
  if (nMode==0)
    iPv.doOperation(ProjectionViewer.COLLAPSE_ALL);
  else if (nMode==1)
    iPv.doOperation(ProjectionViewer.EXPAND_ALL);
  else if (nMode==2)
  {
    try
    {
      CommonReconcilingStrategy iRs = getReconcilingStrategy();
      iRs.setDocument(getDocumentProvider().getDocument(getEditorInput()));
      iRs.initialReconcile();
    }
    catch (Throwable e)
    {
      e.printStackTrace();
    }
  }
}
项目:iTrace-Archive    文件:TokenHighlighter.java   
public TokenHighlighter(StyledText styledText, boolean show, ProjectionViewer projviewer){
    this.styledText = styledText;
    this.projviewer = projviewer;
    this.styledText.addPaintListener(this);
    this.show = show;
    this.numberOfPoints = 1;
    this.points = new Point[numberOfPoints];
    this.pointIndex = 0;
    this.nulls = 0;
    this.eventBroker = PlatformUI.getWorkbench().getService(IEventBroker.class);
    this.eventBroker.subscribe("iTrace/newstresponse", this);
    //this.gazeQueue = Activator.getDefault().gazeTransport.createClient();
    //System.out.println("gazeQueue");
}
项目:iTrace-Archive    文件:ITrace.java   
public void setActiveEditor(IEditorPart editorPart){
    activeEditor = editorPart;
    if(activeEditor == null) return;
    if(!tokenHighlighters.containsKey(editorPart)){
        StyledText styledText = (StyledText) editorPart.getAdapter(Control.class);
        if(styledText != null){
    ITextOperationTarget t = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
    if(t instanceof ProjectionViewer){
        ProjectionViewer projectionViewer = (ProjectionViewer)t;
        tokenHighlighters.put(activeEditor, new TokenHighlighter(styledText, showTokenHighlights, projectionViewer));
    }
}
    }

 }
项目:DarwinSPL    文件:DwprofileCodeFoldingManager.java   
/**
 * <p>
 * Creates a code folding manager to handle the <code>ProjectionAnnotation</code>.
 * </p>
 * 
 * @param sourceViewer the source viewer to calculate the element lines
 */
public DwprofileCodeFoldingManager(ProjectionViewer sourceViewer,de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor textEditor) {
    this.projectionAnnotationModel = sourceViewer.getProjectionAnnotationModel();
    this.sourceViewer = sourceViewer;
    this.editor = textEditor;
    addCloseListener(textEditor);
    try {
        restoreCodeFoldingStateFromFile(editor.getResource().getURI().toString());
    } catch (Exception e) {
        calculatePositions();
    }
}
项目:DarwinSPL    文件:DwprofileEditor.java   
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) {

        public void setSelection(ISelection selection, boolean reveal) {
            if (!DwprofileEditor.this.setSelection(selection, reveal)) {
                super.setSelection(selection, reveal);
            }
        }

    };
    // ensure decoration support has been created and configured.
    getSourceViewerDecorationSupport(viewer);
    return viewer;
}
项目:DarwinSPL    文件:HyexpressionEditor.java   
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) {

        public void setSelection(ISelection selection, boolean reveal) {
            if (!HyexpressionEditor.this.setSelection(selection, reveal)) {
                super.setSelection(selection, reveal);
            }
        }

    };
    // ensure decoration support has been created and configured.
    getSourceViewerDecorationSupport(viewer);
    return viewer;
}
项目:DarwinSPL    文件:HyexpressionCodeFoldingManager.java   
/**
 * <p>
 * Creates a code folding manager to handle the <code>ProjectionAnnotation</code>.
 * </p>
 * 
 * @param sourceViewer the source viewer to calculate the element lines
 */
public HyexpressionCodeFoldingManager(ProjectionViewer sourceViewer,eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor textEditor) {
    this.projectionAnnotationModel = sourceViewer.getProjectionAnnotationModel();
    this.sourceViewer = sourceViewer;
    this.editor = textEditor;
    addCloseListener(textEditor);
    try {
        restoreCodeFoldingStateFromFile(editor.getResource().getURI().toString());
    } catch (Exception e) {
        calculatePositions();
    }
}
项目:DarwinSPL    文件:HyvalidityformulaCodeFoldingManager.java   
/**
 * <p>
 * Creates a code folding manager to handle the <code>ProjectionAnnotation</code>.
 * </p>
 * 
 * @param sourceViewer the source viewer to calculate the element lines
 */
public HyvalidityformulaCodeFoldingManager(ProjectionViewer sourceViewer,eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor textEditor) {
    this.projectionAnnotationModel = sourceViewer.getProjectionAnnotationModel();
    this.sourceViewer = sourceViewer;
    this.editor = textEditor;
    addCloseListener(textEditor);
    try {
        restoreCodeFoldingStateFromFile(editor.getResource().getURI().toString());
    } catch (Exception e) {
        calculatePositions();
    }
}
项目:DarwinSPL    文件:HyvalidityformulaEditor.java   
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) {

        public void setSelection(ISelection selection, boolean reveal) {
            if (!HyvalidityformulaEditor.this.setSelection(selection, reveal)) {
                super.setSelection(selection, reveal);
            }
        }

    };
    // ensure decoration support has been created and configured.
    getSourceViewerDecorationSupport(viewer);
    return viewer;
}
项目:DarwinSPL    文件:HydatavalueEditor.java   
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) {

        public void setSelection(ISelection selection, boolean reveal) {
            if (!HydatavalueEditor.this.setSelection(selection, reveal)) {
                super.setSelection(selection, reveal);
            }
        }

    };
    // ensure decoration support has been created and configured.
    getSourceViewerDecorationSupport(viewer);
    return viewer;
}
项目:DarwinSPL    文件:HydatavalueCodeFoldingManager.java   
/**
 * <p>
 * Creates a code folding manager to handle the <code>ProjectionAnnotation</code>.
 * </p>
 * 
 * @param sourceViewer the source viewer to calculate the element lines
 */
public HydatavalueCodeFoldingManager(ProjectionViewer sourceViewer,eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor textEditor) {
    this.projectionAnnotationModel = sourceViewer.getProjectionAnnotationModel();
    this.sourceViewer = sourceViewer;
    this.editor = textEditor;
    addCloseListener(textEditor);
    try {
        restoreCodeFoldingStateFromFile(editor.getResource().getURI().toString());
    } catch (Exception e) {
        calculatePositions();
    }
}
项目:DarwinSPL    文件:HymappingEditor.java   
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
    ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles) {

        public void setSelection(ISelection selection, boolean reveal) {
            if (!HymappingEditor.this.setSelection(selection, reveal)) {
                super.setSelection(selection, reveal);
            }
        }

    };
    // ensure decoration support has been created and configured.
    getSourceViewerDecorationSupport(viewer);
    return viewer;
}