Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorPart


public class CreateLabel extends AbstractHandler {

  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;
View Full Code Here



  public static final String ID = "de.innovationgate.eclipse.ids.editors.commands.DisplayHelp";
 
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();   
    if (editorPart != null && editorPart instanceof AbstractWGATextEditor) {
     
      AbstractWGATextEditor editor = (AbstractWGATextEditor) editorPart;

      InformationPresenter presenter=
View Full Code Here

  /**
   * retrieves the active file from the active editor
   */
  public IFile getActiveFile() {
    IEditorPart editor = getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    IEditorInput input=null;
   
   
    if(editor!=null){
      input = editor.getEditorInput();
    }
    IFile file = null;
   
    if (input!=null && input instanceof IFileEditorInput) {
      file = ((IFileEditorInput) input).getFile();
View Full Code Here

    return _codeSnippetStore;
  }

  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
View Full Code Here

    }
    return false;
  }
 
  private static String determineContext() {
    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (editorPart != null) {
      if (editorPart instanceof TMLScriptEditor) {
        return Snippet.CONTEXT_TMLScript;
      } else if (editorPart instanceof TMLEditor) {
        // check if current selection is an tmlscript partion - otherwise return TML-Snippet-Context
        ISelection selection = ((TMLEditor) editorPart).getSelectionProvider().getSelection();
        if (selection instanceof ITextSelection) {
          int selectionOffset = ((TextSelection)selection).getOffset();
          IDocument doc = ((TMLEditor)editorPart).getDocumentProvider().getDocument(editorPart.getEditorInput());
          if (doc != null) {
            ITypedRegion partition;
            try {
              partition = doc.getPartition(selectionOffset);
              if (partition.getType().equals(TMLScriptPartitionScanner.TMLSCRIPT)) {
View Full Code Here

    _snippet = snippet;
  }

  @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;
View Full Code Here

        sectionLayout.numColumns = 1;
        sectionClient.setLayout(sectionLayout);
       
        final HyperlinkGroup group = new HyperlinkGroup(sectionClient.getDisplay());
       
        final IEditorPart fEditor = editor;
       
    IMenuService ms = (IMenuService)editor.getSite().getService(IMenuService.class);
    ContributionManager manager = new ContributionManager() {

      public void update(boolean force) {
        IContributionItem[] items = getItems();
        for (IContributionItem item : items) {
          if (item instanceof MenuManager) {
            final MenuManager menu = (MenuManager) item;
            ImageHyperlink link = new ImageHyperlink(sectionClient, SWT.None);
            link.setText(menu.getMenuText());           
            if (menu.getImageDescriptor() != null) {
              link.setImage(menu.getImageDescriptor().createImage());
            }
            link.addHyperlinkListener(new HyperlinkAdapter() {
              public void linkActivated(HyperlinkEvent e) {
                IHandlerService handlerService = (IHandlerService) fEditor.getSite().getService(IHandlerService.class);
                if (handlerService != null) {
                  try {
                    handlerService.executeCommand(menu.getId(), null);
                  } catch (Exception ex) {
                    WorkbenchUtils.showErrorDialog(Plugin.getDefault(), fEditor.getSite().getShell(), "Execution of hyperlink failed", "Unable to execute hyperlink command '" + menu.getId() + "'.", ex);
                  }
                }
              }
            });   
            group.add(link);
View Full Code Here

               
        if (designContainer != null && WGADesignStructureHelper.isDesignFolder(designContainer)) {
          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);
View Full Code Here

public class ToggleComment extends AbstractHandler {

  public static final String ID = "de.innovationgate.eclipse.ids.editors.commands.ToggleComment";
 
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editorPart = Plugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();   
    if (editorPart != null && editorPart instanceof AbstractWGATextEditor) {
      AbstractWGATextEditor editor = (AbstractWGATextEditor) editorPart;     
      ISelection selection = editor.getEditorSite().getSelectionProvider().getSelection();
      if (selection != null && selection instanceof ITextSelection) {
        ITextSelection textSelection = (ITextSelection)selection;
View Full Code Here

  }

  private void onMinimize() {

    /* Mark displayed News as Read on Minimize if set in Preferences */
    IEditorPart activeEditor = OwlUI.getActiveEditor();
    if (activeEditor != null && activeEditor instanceof FeedView) {
      FeedView feedView = (FeedView) activeEditor;
      feedView.notifyUIEvent(FeedView.UIEvent.MINIMIZE);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorPart

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.