Package org.eclipse.ui.texteditor

Examples of org.eclipse.ui.texteditor.ITextEditor


   * @see EditorActionBarContributor#editorChanged
   */
  public void setActiveEditor(IEditorPart part) {
    super.setActiveEditor(part);

    ITextEditor editor = null;
    if (part instanceof ITextEditor)
      editor = (ITextEditor) part;

    formatProposal.setAction(getAction(editor, "ContentFormatProposal"));
  }
View Full Code Here


  public static final String ID = "de.innovationgate.eclipse.ids.editors.TMLEditor.commands.CreateLabel";

  public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (editorPart != null && editorPart instanceof ITextEditor) {
      ITextEditor editor = (ITextEditor) editorPart;
      ISelection selection = editor.getEditorSite().getSelectionProvider().getSelection();
      if (selection != null && selection instanceof ITextSelection) {
        ITextSelection textSelection = (ITextSelection) selection;
        IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
        if (doc != null) {
          if(textSelection.getLength()>0){
            new LabelingDialog(editor.getEditorSite().getShell(), textSelection, doc).open();
          }
        }
      }

    }
View Full Code Here

  public void openLabelEditor(IFile labelFile, String labelKey) {
    try {
      IEditorPart editor = WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), labelFile);
      if (editor instanceof TextEditor) {
        ITextEditor textEditor = (ITextEditor) editor;
        IDocument doc = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
        try {
          // search for line starting with label key
          FindReplaceDocumentAdapter finder = new FindReplaceDocumentAdapter(doc);
          IRegion keyRegion = finder.find(0, "^" + LabelFileEncodingHelper.saveConvert(labelKey,true).replaceAll("\\\\", "\\\\\\\\") + "\\s*=", true, false, false, true);
          if (keyRegion != null) {
            textEditor.getSelectionProvider().setSelection(new TextSelection(keyRegion.getOffset() + keyRegion.getLength(),0));
          }
        } catch (BadLocationException e) {
        }
      }
    } catch (PartInitException e) {
View Full Code Here

  @Override
  public void run() {
    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();   
    if (editorPart != null && editorPart instanceof ITextEditor) {
      ITextEditor editor = (ITextEditor) editorPart;
      ISelection selection = editor.getEditorSite().getSelectionProvider().getSelection();
      if (selection != null && selection instanceof ITextSelection) {
        ITextSelection textSelection = (ITextSelection)selection;
        IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
        if (doc != null) {
          try {
            _snippet.apply(doc, textSelection, editor);
          } catch (BadLocationException e) {
          }
View Full Code Here

          WGADesignStructureHelper helper = new WGADesignStructureHelper(designContainer);
          IFile file = helper.findReferencedTMLModule(_warning.getResource(), _warning.getMedium());
          if (file != null && file.exists()) {
            IEditorPart editor = WorkbenchUtils.openEditor(WGADesignerPlugin.getDefault().getWorkbench(), file);
            if (editor instanceof ITextEditor) {
              ITextEditor textEditor = (ITextEditor) editor;
              int offset = 0;
              if (_warning.getLine() != -1) {
                offset = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()).getLineOffset(_warning.getLine()-1);
              }
              textEditor.getSelectionProvider().setSelection(new TextSelection(offset, 0));
            }
          } else {
            WorkbenchUtils.showErrorDialog(Display.getCurrent().getActiveShell(), "Unable to open tml warning hyperlink.", "Referenced tml file '" + _warning.getMedium() + "/" + _warning.getResource() + "' not found.");
          }
        } else {
View Full Code Here

    private void generateFixes(String message, IMarker marker) {
        boolean fixable = marker.getAttribute(BuildErrorDetailsHandler.PROP_HAS_RESOLUTIONS, false);
        if (!fixable)
            return;

        ITextEditor sourcePage = editor.getSourcePage();
        if (sourcePage == null)
            return;
        IDocument document = sourcePage.getDocumentProvider().getDocument(getEditorInput());

        String type = marker.getAttribute("$bndType", (String) null);
        if (type == null)
            return;
View Full Code Here

        activeEditorPart = part;

        IActionBars actionBars = getActionBars();
        if (actionBars != null) {

            ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;

            actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE));
            actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO));
            actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO));
            actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT));
View Full Code Here

  @Override
  public final IHyperlink[] detectHyperlinks(final ITextViewer textViewer, final IRegion region,
      final boolean canShowMultipleHyperlinks)
  {
    ITextEditor textEditor= (ITextEditor) getAdapter(ITextEditor.class);
    if (region == null || !(textEditor instanceof JavaEditor))
    {
      return null;
    }

    ITypeRoot input = EditorUtility.getEditorInputJavaElement(textEditor, false);
    if (input == null)
    {
      return null;
    }

    IAction openAction= textEditor.getAction("OpenEditor"); //$NON-NLS-1$
    if (!(openAction instanceof SelectionDispatchAction))
    {
      return null;
    }
View Full Code Here

    private void generateFixes(String message, IMarker marker) {
        boolean fixable = marker.getAttribute(BuildErrorDetailsHandler.PROP_HAS_RESOLUTIONS, false);
        if (!fixable)
            return;

        ITextEditor sourcePage = editor.getSourcePage();
        if (sourcePage == null)
            return;

        String type = marker.getAttribute("$bndType", (String) null);
        if (type == null)
View Full Code Here

        Job job =
            new Job("Toggle Line Breakpoint (epic)")
        {
            protected IStatus run(IProgressMonitor monitor)
            {
                ITextEditor editor = getTextEditor(part);
                if ((editor == null) || ! (selection instanceof ITextSelection))
                {
                    return Status.OK_STATUS;
                }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.texteditor.ITextEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.