Java 类org.eclipse.jface.text.TextViewer 实例源码

项目:tm4e    文件:TMEditor.java   
public TMEditor(IGrammar grammar, ITokenProvider tokenProvider, String text) {
    shell = new Shell();
    viewer = new TextViewer(shell, SWT.NONE);
    document = new Document();
    viewer.setDocument(document);
    commands = new ArrayList<>();
    collector = new StyleRangesCollector();

    setAndExecute(text);

    reconciler = new TMPresentationReconciler();
    reconciler.addTMPresentationReconcilerListener(collector);
    reconciler.setGrammar(grammar);
    reconciler.setTokenProvider(tokenProvider);
    reconciler.install(viewer);

}
项目:Black    文件:black.java   
/**
 * �����༭��
 * 
 * @return
 */
public void createTextArea(TextViewerUndoManager undo) {
    if (wv == null || wv.isDisposed()) {

        tv = new TextViewer(this, SWT.WRAP | SWT.V_SCROLL);
        StyledText styledText = tv.getTextWidget();
        if (undo != null) {
            undo.disconnect();
            undo.connect(tv);
        } else
            tvum = new TextViewerUndoManager(100);
        tv.setUndoManager(tvum);
        tv.activatePlugins();
        setCurrentTextArea(styledText);
        blackTextArea = new blackTextArea(styledText, this);
    } else {
        // wv.disposeTextArea();
        wv.createTextArea(null);
    }
}
项目:Black    文件:writingView.java   
public void createTextArea(IDocument iDocument){

    if(b.text != null && !b.text.isDisposed()){
        disposeTextArea();
    }
    b.tv = new TextViewer(b, SWT.V_SCROLL|SWT.WRAP);
    b.text = b.tv.getTextWidget();
    b.text.setVisible(false);
    b.text.setParent(this);
    setStyledTextLayout(x);
    b.blackTextArea = new blackTextArea(b.text,b);
    b.blackTextArea.writingView();
    b.tv.setUndoManager(new TextViewerUndoManager(100));
    b.tv.activatePlugins();
    if(b.ba.isFullScreenWritingView())
        b.ba.changeColor(b.ba.lastForeColor, b.ba.lastBackColor);
    if(iDocument != null) {
        b.tv.setDocument(iDocument);
    }
    addSlider();
    layout();
    b.text.setFocus();
    b.text.setVisible(true);
}
项目:typescript.java    文件:TypeScriptMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer viewer) {
    if (viewer instanceof SourceViewer) {
        SourceViewer sourceViewer = (SourceViewer) viewer;
        if (fSourceViewer == null)
            fSourceViewer = new ArrayList<>();
        if (!fSourceViewer.contains(sourceViewer))
            fSourceViewer.add(sourceViewer);
        TypeScriptTextTools tools = JSDTTypeScriptUIPlugin.getDefault().getJavaTextTools();
        if (tools != null) {
            IEditorInput editorInput = getEditorInput(sourceViewer);
            sourceViewer.unconfigure();
            if (editorInput == null) {
                sourceViewer.configure(getSourceViewerConfiguration(sourceViewer, null));
                return;
            }
            getSourceViewerConfiguration(sourceViewer, editorInput);
        }
    }
}
项目:bpm-beans    文件:DecisionTableEditor.java   
private CTabItem createDMNtab()
{
  CTabItem dmnTab = new CTabItem(tabs, SWT.NONE);
  dmnTab.setText("DMN");
  // assign a XML or DMN icon
  TextViewer dmnViewer = new TextViewer(tabs, SWT.V_SCROLL);
  dmnViewer.setDocument(new Document());
  dmnTab.setControl(dmnViewer.getTextWidget());
  dmnTab.addListener(SWT.SELECTED, evt -> {
    dmnViewer.getDocument().set(toDMN(table.model));
  });

  tabs.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent e) {
      tabs.getSelection().notifyListeners(SWT.SELECTED, new Event());
    }
   });
  return dmnTab;
}
项目:PDFReporter-Studio    文件:StyledTextXtextAdapter2.java   
/**
 * Tries to tell to the Xtext viewer whether the registered
 * auto edit strategies should be ignored.
 * 
 * @param ignore <code>true</code> if the strategies should be ignored.
 */
public void ignoreAutoEditStrategies(boolean ignore){
    try {
        // org.eclipse.jface.text.TextViewer#ignoreAutoEditStrategies(boolean) is protected by definition.
        // XtextSourceViewer does not extend its visibility so we have to bypass it
        // invoking the method via Reflection API.
        // N.B: This way of using reflection is a "violation" of OOP basis but
        // it is also a trick that works fine.
        Method declaredMethod = TextViewer.class.getDeclaredMethod("ignoreAutoEditStrategies",boolean.class); //$NON-NLS-1$
        declaredMethod.setAccessible(true);
        declaredMethod.invoke(getXtextSourceviewer(), ignore);
    } catch (Exception e) {
        JRExpressionsActivator.getInstance().getLog().log(
                new Status(IStatus.ERROR, JRExpressionsUIPlugin.PLUGIN_ID, 
                        Messages.StyledTextXtextAdapter2_AutoEditStrategiesError, e));
    }
}
项目:APICloud-Studio    文件:CommonMergeViewer.java   
@Override
protected void configureTextViewer(final TextViewer textViewer)
{
    ThemePlugin.getDefault().getControlThemerFactory().apply(textViewer);

    // Force line highlight color. We need to perform this after the line painter is attached, which happens after
    // the return of this method. Scheduling async seems to work.
    UIUtils.getDisplay().asyncExec(new Runnable()
    {

        public void run()
        {
            CursorLinePainter p = getCursorLinePainterInstalled(textViewer);
            if (p != null)
            {
                p.setHighlightColor(getColorManager().getColor(getCurrentTheme().getLineHighlightAgainstBG()));
            }
        }
    });
}
项目:APICloud-Studio    文件:CommonMergeViewer.java   
private CursorLinePainter getCursorLinePainterInstalled(TextViewer viewer)
{
    Listener[] listeners = viewer.getTextWidget().getListeners(3001/* StyledText.LineGetBackground */);
    for (Listener listener : listeners)
    {
        if (listener instanceof TypedListener)
        {
            TypedListener typedListener = (TypedListener) listener;
            if (typedListener.getEventListener() instanceof CursorLinePainter)
            {
                return (CursorLinePainter) typedListener.getEventListener();
            }
        }
    }
    return null;
}
项目:APICloud-Studio    文件:CommonProjectionViewer.java   
@Override
protected void handleDispose()
{
    // HACK We force the widget command to be nulled out so it can be garbage collected. Might want to
    // report a bug with eclipse to clean this up.
    try
    {
        Field f = TextViewer.class.getDeclaredField("fWidgetCommand"); //$NON-NLS-1$
        if (f != null)
        {
            f.setAccessible(true);
            f.set(this, null);
        }
    }
    catch (Throwable t)
    {
        // ignore
    }
    finally
    {
        super.handleDispose();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:PropertiesFileMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer) {
    if (!(textViewer instanceof SourceViewer))
        return;

    if (fPreferenceStore == null) {
        fSourceViewerConfigurations= new ArrayList<SourceViewerConfiguration>(3);
        fPreferenceStore= JavaPlugin.getDefault().getCombinedPreferenceStore();
        fPreferenceChangeListener= new IPropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent event) {
                Iterator<SourceViewerConfiguration> iter= fSourceViewerConfigurations.iterator();
                while (iter.hasNext())
                    ((PropertiesFileSourceViewerConfiguration)iter.next()).handlePropertyChangeEvent(event);
                invalidateTextPresentation();
            }
        };
        fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);
    }

    SourceViewerConfiguration sourceViewerConfiguration= new PropertiesFileSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), fPreferenceStore, null,
            getDocumentPartitioning());

    fSourceViewerConfigurations.add(sourceViewerConfiguration);
    ((SourceViewer)textViewer).configure(sourceViewerConfiguration);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer viewer) {
    if (viewer instanceof SourceViewer) {
        SourceViewer sourceViewer= (SourceViewer)viewer;
        if (fSourceViewer == null)
            fSourceViewer= new ArrayList<SourceViewer>();
        if (!fSourceViewer.contains(sourceViewer))
            fSourceViewer.add(sourceViewer);
        JavaTextTools tools= JavaCompareUtilities.getJavaTextTools();
        if (tools != null) {
            IEditorInput editorInput= getEditorInput(sourceViewer);
            sourceViewer.unconfigure();
            if (editorInput == null) {
                sourceViewer.configure(getSourceViewerConfiguration(sourceViewer, null));
                return;
            }
            getSourceViewerConfiguration(sourceViewer, editorInput);
        }
    }
}
项目:anatlyzer    文件:ExplanationComposite.java   
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public ExplanationComposite(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout(1, false));

    SashForm sashForm = new SashForm(this, SWT.NONE);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    sashForm.setLocation(0, 0);

    TextViewer textViewer = new TextViewer(sashForm, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
    styledTextExplanation = textViewer.getTextWidget();
    styledTextExplanation.setEditable(false);

    composite = new Composite(sashForm, SWT.NONE);
    composite.setLayout(new FillLayout(SWT.HORIZONTAL));
    sashForm.setWeights(new int[] {1, 2});

}
项目:anatlyzer    文件:QuickfixDialog.java   
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    container.setLayout(new GridLayout(1, false));

    Label lblFixes = new Label(container, SWT.NONE);
    lblFixes.setText("Fixes");

    tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION);
    table = tableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TextViewer textViewer = new TextViewer(container, SWT.BORDER);
    StyledText styledText = textViewer.getTextWidget();
    styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    tableViewer.setContentProvider(new QuickfixContentProvider());
    tableViewer.setLabelProvider(new QuickfixLabelProvider());
    tableViewer.setInput(quickfixes);
    return container;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:PropertiesFileMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer) {
    if (!(textViewer instanceof SourceViewer))
        return;

    if (fPreferenceStore == null) {
        fSourceViewerConfigurations= new ArrayList<SourceViewerConfiguration>(3);
        fPreferenceStore= JavaPlugin.getDefault().getCombinedPreferenceStore();
        fPreferenceChangeListener= new IPropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent event) {
                Iterator<SourceViewerConfiguration> iter= fSourceViewerConfigurations.iterator();
                while (iter.hasNext())
                    ((PropertiesFileSourceViewerConfiguration)iter.next()).handlePropertyChangeEvent(event);
                invalidateTextPresentation();
            }
        };
        fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);
    }

    SourceViewerConfiguration sourceViewerConfiguration= new PropertiesFileSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), fPreferenceStore, null,
            getDocumentPartitioning());

    fSourceViewerConfigurations.add(sourceViewerConfiguration);
    ((SourceViewer)textViewer).configure(sourceViewerConfiguration);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer viewer) {
    if (viewer instanceof SourceViewer) {
        SourceViewer sourceViewer= (SourceViewer)viewer;
        if (fSourceViewer == null)
            fSourceViewer= new ArrayList<SourceViewer>();
        if (!fSourceViewer.contains(sourceViewer))
            fSourceViewer.add(sourceViewer);
        JavaTextTools tools= JavaCompareUtilities.getJavaTextTools();
        if (tools != null) {
            IEditorInput editorInput= getEditorInput(sourceViewer);
            sourceViewer.unconfigure();
            if (editorInput == null) {
                sourceViewer.configure(getSourceViewerConfiguration(sourceViewer, null));
                return;
            }
            getSourceViewerConfiguration(sourceViewer, editorInput);
        }
    }
}
项目: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    文件:AutoEditStrategyScopeCreationHelper.java   
/**
 * @param ps
 * @param provider
 */
public boolean perform(TextSelectionUtils ps, final char c, TextViewer viewer, IScopeCreatingCharsProvider provider) {
    linkOffset = -1;
    linkExitPos = -1;
    linkLen = 0;

    try {
        IDocument doc = ps.getDoc();

        DocCmd docCmd = new DocCmd(ps.getAbsoluteCursorOffset(), ps.getSelLength(), Character.toString(c));
        if (!handleScopeCreationChar(doc, docCmd, ps, provider, c)) {
            return false; //not handled
        }
        if (linkOffset == -1 || linkExitPos == -1) {
            return true; //it was handled (without the link)
        }

        if (viewer != null) {
            viewer.setSelectedRange(linkOffset, linkLen);
        }

    } catch (Exception e) {
        Log.log(e);
    }
    return true;
}
项目:clickwatch    文件:ResultView.java   
@Override
public void createPartControl(Composite parent) {
    layout = new StackLayout();
    parent.setLayout(layout);
    treeViewer = new TreeViewer(parent);

    treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
    treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));

    new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);

    textViewer = new TextViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);

    layout.topControl = treeViewer.getControl();

    makeActions();
    contributeToActionBars();       
}
项目:codelens-eclipse    文件:ViewZoneDemo.java   
public static void main(String[] args) throws Exception {
    // create the widget's shell
    Shell shell = new Shell();
    shell.setLayout(new FillLayout());
    shell.setSize(500, 500);
    Display display = shell.getDisplay();

    Composite parent = new Composite(shell, SWT.NONE);
    parent.setLayout(new GridLayout(2, false));

    ITextViewer textViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.BORDER);
    textViewer.setDocument(new Document(""));
    StyledText styledText = textViewer.getTextWidget();
    styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

    ViewZoneChangeAccessor viewZones = new ViewZoneChangeAccessor(textViewer);

    Button add = new Button(parent, SWT.NONE);
    add.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 0, 0));
    add.setText("Add Zone");
    add.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "", "Enter view zone content",
                    "Zone " + viewZones.getSize(), null);
            if (dlg.open() == Window.OK) {
                int line = styledText.getLineAtOffset(styledText.getCaretOffset());
                IViewZone zone = new DefaultViewZone(line, 20, dlg.getValue());
                viewZones.addZone(zone);
                viewZones.layoutZone(zone);
            }
        }
    });

    shell.open();
    while (!shell.isDisposed())
        if (!display.readAndDispatch())
            display.sleep();
}
项目:codelens-eclipse    文件:CodeLensDemo.java   
public static void main(String[] args) throws Exception {
    // create the widget's shell
    Shell shell = new Shell();
    shell.setLayout(new FillLayout());
    shell.setSize(500, 500);
    Display display = shell.getDisplay();

    Composite parent = new Composite(shell, SWT.NONE);
    parent.setLayout(new GridLayout(2, false));

    ITextViewer textViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.BORDER);
    String delim = textViewer.getTextWidget().getLineDelimiter();
    textViewer.setDocument(new Document(delim + " class A" + delim + "new A" + delim + "new A" + delim + "class B"
            + delim + "new B" + delim + "interface I" + delim + "class C implements I"));
    StyledText styledText = textViewer.getTextWidget();
    styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

    CodeLensProviderRegistry registry = CodeLensProviderRegistry.getInstance();
    registry.register(CONTENT_TYPE_ID, new ClassReferencesCodeLensProvider());
    registry.register(CONTENT_TYPE_ID, new ClassImplementationsCodeLensProvider());

    CodeLensStrategy codelens = new CodeLensStrategy(new DefaultCodeLensContext(textViewer), false);
    codelens.addTarget(CONTENT_TYPE_ID).reconcile(null);

    styledText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent event) {
            codelens.reconcile(null);
        }
    });

    shell.open();
    while (!shell.isDisposed())
        if (!display.readAndDispatch())
            display.sleep();
}
项目:tm4e    文件:TMPresentationReconciler.java   
/**
 * Initialize foreground, background color, current line highlight from the
 * current theme if needed.
 * 
 */
private void applyThemeEditorIfNeeded() {
    if (!initializeViewerColors) {
        StyledText styledText = viewer.getTextWidget();
        ((ITheme) tokenProvider).initializeViewerColors(styledText);
        initializeViewerColors = true;
    }
    if (!updateTextDecorations) {
        try {
            // Ugly code to update "current line highlight" :
            // - get the PaintManager from the ITextViewer with reflection.
            // - get the list of IPainter of PaintManager with reflection
            // - loop for IPainter to retrieve CursorLinePainter which manages "current line
            // highlight".
            PaintManager paintManager = ClassHelper.getFieldValue(viewer, "fPaintManager", TextViewer.class);
            if (paintManager != null) {
                List<IPainter> painters = ClassHelper.getFieldValue(paintManager, "fPainters", PaintManager.class);
                if (painters != null) {
                    for (IPainter painter : painters) {
                        if (painter instanceof CursorLinePainter) {
                            // Update current line highlight
                            Color background = tokenProvider.getEditorCurrentLineHighlight();
                            if (background != null) {
                                ((CursorLinePainter) painter).setHighlightColor(background);
                            }
                            updateTextDecorations = true;
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
项目:tm4e    文件:TextUtils.java   
public static TabSpacesInfo getTabSpaces(ITextViewer viewer) {
    TabsToSpacesConverter converter = ClassHelper.getFieldValue(viewer, "fTabsToSpacesConverter", TextViewer.class);
    if (converter != null) {
        int tabSize = ClassHelper.getFieldValue(converter, "fTabRatio", TabsToSpacesConverter.class);
        return new TabSpacesInfo(tabSize, true);
    }
    return new TabSpacesInfo(-1, false);
}
项目:Black    文件:ioThread.java   
/**
 * 
 * @param black
 * @param file
 * @param writeOrRead 1Ϊд�룬����ֵ���ʾ��ȡ
 */
public ioThread(black black, File file, int writeOrRead, IDocument doc, TextViewer tv, Properties styles) {
    this.black = black;
    this.file = file;
    this.writeOrRead = writeOrRead;
    this.doc = doc;
    this.tv = tv;
    this.styles = styles;
}
项目:Black    文件:blackAction.java   
public void exportFiles(ArrayList<String> al, File outputfile) {
    if (b.fileindex != null) {
        TextViewer tv = new TextViewer(b, SWT.V_SCROLL | SWT.WRAP);
        StyledText styledText = tv.getTextWidget();
        // blackTextArea blackTextArea = new blackTextArea(styledText, b);
        styledText.setVisible(false);
        XWPFDocument doc = new XWPFDocument();
        ioThread io = new ioThread(b);
        Iterator<String> it = al.iterator();
        while (it.hasNext()) {
            String filename = it.next();
            File file = new File(b.projectFile.getParent() + "\\Files\\" + filename);
            if (file.exists()) {
                io.readBlackFile(file, tv);
                saveStylesToDocxFile(styledText, doc);
                // doc.createParagraph().set
            }
        }
        BufferedOutputStream bos = io.getBufferedFileOutputStream(outputfile);
        try {
            doc.write(bos);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        tv.getTextWidget().dispose();
        getMessageBox("", "������" + al.size() + "���ļ�");
    }
}
项目:Black    文件:blackAction.java   
public void replaceInAllFile(String word1, String word2, boolean forwardSearch, boolean caseSensitive,
        boolean wholeWord, boolean regularExpressions) {
    int i = 0;
    if (b.projectFile != null) {
        File dir = new File(b.projectFile.getParent() + "\\Files");
        String[] files = dir.list();
        TextViewer tv = new TextViewer(b, SWT.None);
        // �滻��ʼǰ���沢�رյ�ǰ����ʹ�õ��ļ�
        File oldfile = b.getCurrentEditFile();
        b.closeCurrentFile(true);
        for (String file : files) {
            File f = new File(dir + "\\" + file);
            ioThread io = new ioThread(b, f, 0, null, tv, null);
            b.getDisplay().syncExec(io);

            int a = b.blackTextArea.replace(io.doc, word1, word2, forwardSearch, caseSensitive, wholeWord, false,
                    regularExpressions);
            i += a;
            if (a > 0) {
                ioThread ioi = new ioThread(b, f, 1, io.doc, null, getAllStyleRange(tv.getTextWidget()));
                b.getDisplay().asyncExec(ioi);
            }
        }
        tv.getTextWidget().dispose();
        getMessageBox("����/�滻��Ϣ", "�滻��ɣ�\n���滻��" + i + "��");
        openFile(oldfile, true);
    }
}
项目:fluentmark    文件:SmartBackspaceManager.java   
private void beginChange() {
    ITextViewer viewer = fViewer;
    if (viewer instanceof TextViewer) {
        TextViewer v = (TextViewer) viewer;
        v.getRewriteTarget().beginCompoundChange();
    }
}
项目:fluentmark    文件:SmartBackspaceManager.java   
private void endChange() {
    ITextViewer viewer = fViewer;
    if (viewer instanceof TextViewer) {
        TextViewer v = (TextViewer) viewer;
        v.getRewriteTarget().endCompoundChange();
    }
}
项目:APICloud-Studio    文件:SVGMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer)
{
    super.configureTextViewer(textViewer);

    if (textViewer instanceof SourceViewer)
    {
        SourceViewer sourceViewer = (SourceViewer) textViewer;
        sourceViewer.unconfigure();
        IPreferenceStore preferences = SVGEditor.getChainedPreferenceStore();
        SVGSourceViewerConfiguration config = new SVGSourceViewerConfiguration(preferences, null);
        sourceViewer.configure(config);
    }
}
项目:APICloud-Studio    文件:XMLMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer)
{
    super.configureTextViewer(textViewer);

    if (textViewer instanceof SourceViewer)
    {
        SourceViewer sourceViewer = (SourceViewer) textViewer;
        sourceViewer.unconfigure();
        IPreferenceStore preferences = XMLEditor.getChainedPreferenceStore();
        XMLSourceViewerConfiguration config = new XMLSourceViewerConfiguration(preferences, null);
        sourceViewer.configure(config);
    }
}
项目:APICloud-Studio    文件:JSMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer)
{
    super.configureTextViewer(textViewer);

    if (textViewer instanceof SourceViewer)
    {
        SourceViewer sourceViewer = (SourceViewer) textViewer;
        sourceViewer.unconfigure();
        IPreferenceStore preferences = JSSourceEditor.getChainedPreferenceStore();
        JSSourceViewerConfiguration config = new JSSourceViewerConfiguration(preferences, null);
        sourceViewer.configure(config);
    }
}
项目:APICloud-Studio    文件:DTDMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer)
{
    super.configureTextViewer(textViewer);

    if (textViewer instanceof SourceViewer)
    {
        SourceViewer sourceViewer = (SourceViewer) textViewer;
        sourceViewer.unconfigure();
        IPreferenceStore preferences = DTDEditor.getChainedPreferenceStore();
        DTDSourceViewerConfiguration config = new DTDSourceViewerConfiguration(preferences, null);
        sourceViewer.configure(config);
    }
}
项目:APICloud-Studio    文件:CSSMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer)
{
    super.configureTextViewer(textViewer);

    if (textViewer instanceof SourceViewer)
    {
        SourceViewer sourceViewer = (SourceViewer) textViewer;
        sourceViewer.unconfigure();
        IPreferenceStore preferences = CSSSourceEditor.getChainedPreferenceStore();
        CSSSourceViewerConfiguration config = new CSSSourceViewerConfiguration(preferences, null);
        sourceViewer.configure(config);
    }
}
项目:APICloud-Studio    文件:FormatterModifyTabPage.java   
protected Composite doCreatePreviewPane(Composite composite, int numColumns)
{
    createLabel(numColumns - 1, composite, FormatterMessages.FormatterModifyTabPage_preview_label_text);

    fShowInvisibleButton = new Button(composite, SWT.CHECK);
    fShowInvisibleButton.setText(FormatterMessages.FormatterModifyTabPage_showInvisible);
    fShowInvisibleButton.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false));
    fShowInvisibleButton.addSelectionListener(new SelectionAdapter()
    {
        public void widgetSelected(SelectionEvent e)
        {
            final boolean newValue = fShowInvisibleButton.getSelection();
            updateShowInvisible(newValue);
            getDialogSettings().put(SHOW_INVISIBLE_PREFERENCE_KEY, newValue);
        }
    });
    previewViewer = dialog.getOwner().createPreview(composite);
    final boolean savedValue = getDialogSettings().getBoolean(SHOW_INVISIBLE_PREFERENCE_KEY);
    fShowInvisibleButton.setSelection(savedValue);
    updateShowInvisible(savedValue);

    if (previewViewer instanceof TextViewer)
    {
        GridData gd = createGridData(numColumns, GridData.FILL_BOTH, 0);
        gd.widthHint = 100;
        gd.heightHint = 100;
        ((TextViewer) previewViewer).getControl().setLayoutData(gd);
    }

    return composite;
}
项目:APICloud-Studio    文件:HTMLMergeViewer.java   
@Override
protected void configureTextViewer(TextViewer textViewer)
{
    super.configureTextViewer(textViewer);

    if (textViewer instanceof SourceViewer)
    {
        SourceViewer sourceViewer = (SourceViewer) textViewer;
        sourceViewer.unconfigure();
        IPreferenceStore preferences = HTMLEditor.getChainedPreferenceStore();
        HTMLSourceViewerConfiguration config = new HTMLSourceViewerConfiguration(preferences, null);
        sourceViewer.configure(config);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SourceView.java   
/**
 * Creates the action.
 *
 * @param textViewer the text viewer
 */
public SelectAllAction(TextViewer textViewer) {
    super("selectAll"); //$NON-NLS-1$

    Assert.isNotNull(textViewer);
    fTextViewer= textViewer;

    setText(InfoViewMessages.SelectAllAction_label);
    setToolTipText(InfoViewMessages.SelectAllAction_tooltip);
    setDescription(InfoViewMessages.SelectAllAction_description);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IAbstractTextEditorHelpContextIds.SELECT_ALL_ACTION);
}
项目:Eclipse-Postfix-Code-Completion    文件:SmartBackspaceManager.java   
private void beginChange() {
    ITextViewer viewer= fViewer;
    if (viewer instanceof TextViewer) {
        TextViewer v= (TextViewer) viewer;
        v.getRewriteTarget().beginCompoundChange();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SmartBackspaceManager.java   
private void endChange() {
    ITextViewer viewer= fViewer;
    if (viewer instanceof TextViewer) {
        TextViewer v= (TextViewer) viewer;
        v.getRewriteTarget().endCompoundChange();
    }
}
项目:anatlyzer    文件:ATLTextViewer.java   
protected void configureTextViewer(TextViewer textViewer) {
    if(textViewer instanceof ISourceViewer){
        AtlEditorExt editor = new AtlEditorExt();       

        SourceViewerConfiguration configuration= new AtlSourceViewerConfigurationExt(AtlUIPlugin.getDefault().getTextTools(), editor);
        ((ISourceViewer)textViewer).configure(configuration);
    }
}
项目:anatlyzer    文件:StatisticResult.java   
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));

    TabFolder tabFolder = new TabFolder(container, SWT.NONE);

    TabItem tbtmStatistics = new TabItem(tabFolder, SWT.NONE);
    tbtmStatistics.setText("Statistics");

    Composite composite = new Composite(tabFolder, SWT.NONE);
    tbtmStatistics.setControl(composite);
    composite.setLayout(new GridLayout(1, false));

    TextViewer textViewer = new TextViewer(composite, SWT.BORDER);
    txtStatistics = textViewer.getTextWidget();
    txtStatistics.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TabItem tbtmNewItem = new TabItem(tabFolder, SWT.NONE);
    tbtmNewItem.setText("Transformation type");

    Composite composite_1 = new Composite(tabFolder, SWT.NONE);
    tbtmNewItem.setControl(composite_1);
    composite_1.setLayout(new GridLayout(1, false));

    TextViewer textViewer_1 = new TextViewer(composite_1, SWT.BORDER);
    txtTrafoType = textViewer_1.getTextWidget();
    txtTrafoType.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    fillText();

    return container;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SourceView.java   
/**
 * Creates the action.
 *
 * @param textViewer the text viewer
 */
public SelectAllAction(TextViewer textViewer) {
    super("selectAll"); //$NON-NLS-1$

    Assert.isNotNull(textViewer);
    fTextViewer= textViewer;

    setText(InfoViewMessages.SelectAllAction_label);
    setToolTipText(InfoViewMessages.SelectAllAction_tooltip);
    setDescription(InfoViewMessages.SelectAllAction_description);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IAbstractTextEditorHelpContextIds.SELECT_ALL_ACTION);
}