Examples of ITextEditor


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

Examples of org.eclipse.ui.texteditor.ITextEditor

  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

Examples of org.eclipse.ui.texteditor.ITextEditor

  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

Examples of org.eclipse.ui.texteditor.ITextEditor

  @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

Examples of org.eclipse.ui.texteditor.ITextEditor

          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

Examples of org.eclipse.ui.texteditor.ITextEditor

    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

Examples of org.eclipse.ui.texteditor.ITextEditor

        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

Examples of org.eclipse.ui.texteditor.ITextEditor

  @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

Examples of org.eclipse.ui.texteditor.ITextEditor

    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

Examples of org.eclipse.ui.texteditor.ITextEditor

        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
Copyright © 2018 www.massapi.com. 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.