Class ProjectTranslationView

java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.ViewPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IPersistable, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class ProjectTranslationView extends AbstractServiceView
  • Constructor Details

    • ProjectTranslationView

      public ProjectTranslationView()
  • Method Details

    • setActiveText

      public void setActiveText(String text)
      Description copied from class: AbstractServiceView
      Sets active text for translating to translate.
      Overrides:
      setActiveText in class AbstractServiceView
      Parameters:
      text - a text for translating
    • setTargetLanguage

      public void setTargetLanguage(String locale)
    • getTargetLanguage

      public Optional<String> getTargetLanguage()
    • setProject

      public void setProject(ITranslatingProject project)
    • getProject

      public Optional<ITranslatingProject> getProject()
    • getProjectName

      public Optional<String> getProjectName()
    • createPartControl

      public void createPartControl(org.eclipse.swt.widgets.Composite parent)
      Specified by:
      createPartControl in interface org.eclipse.ui.IWorkbenchPart
      Overrides:
      createPartControl in class AbstractServiceView
    • closed

      public void closed()
      Overrides:
      closed in class ManagedViewPart
    • startTranslating

      public void startTranslating()
      Description copied from class: AbstractServiceView
      Starts translating.

      Before start translation process this method calls AbstractServiceView.stopTranslating() to stop the active translation process if it is present. After that it calls AbstractServiceView.createTranslationJob() to create a new job to run it. It does nothing if AbstractServiceView.createTranslationJob() method returns Optional.empty().

      Overrides:
      startTranslating in class AbstractServiceView
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.eclipse.ui.IWorkbenchPart
      Overrides:
      dispose in class ManagedViewPart
    • handleTextSelection

      protected void handleTextSelection(org.eclipse.jface.text.ITextSelection selection)
    • handleStructedSelection

      protected void handleStructedSelection(IStructuredSelection selection)
    • broughtToTop

      public void broughtToTop()
      Overrides:
      broughtToTop in class ManagedViewPart
    • hidden

      public void hidden()
      Overrides:
      hidden in class ManagedViewPart
    • initMainControl

      protected void initMainControl(org.eclipse.swt.widgets.Composite top)
      Description copied from class: AbstractServiceView
      Creates a main control.

      In most cases this control is used for showing translation results. This component is located between the text component (for active text) in the top and error component in the bottom (for showing information about errors).

      Specified by:
      initMainControl in class AbstractServiceView
      Parameters:
      top - a parent component for main control
    • clear

      protected void clear()
      Description copied from class: AbstractServiceView
      Clears this view.

      It detaches the active applicable object (sets value for object as Optional.empty()) from this view, sets active text as empty and hides all errors from error component. Also this method should be used for clearing controls that contains not static data (like text fields or tables).

      Overrides:
      clear in class AbstractServiceView
    • createTranslationJob

      protected org.eclipse.core.runtime.jobs.Job createTranslationJob()
      Description copied from class: AbstractServiceView
      Creates a job that does a translation work.
      Specified by:
      createTranslationJob in class AbstractServiceView
      Returns:
      a new translation job or null if it's impossible to create a job
    • initToolBar

      protected void initToolBar(org.eclipse.jface.action.IToolBarManager tbm)
      Description copied from class: AbstractServiceView
      Initializes items for the given toolbar menu.
      Specified by:
      initToolBar in class AbstractServiceView
      Parameters:
      tbm - a toolbar manager for that items will be added
    • initMenu

      protected void initMenu(org.eclipse.jface.action.IMenuManager menuManager)
      Description copied from class: AbstractServiceView
      Initializes a menu actions on the given menu manager.
      Overrides:
      initMenu in class AbstractServiceView
      Parameters:
      menuManager - a menu manager for that a menu items will be added