Example #1
0
def __prepareUI__():
    global __perspectiveDesc__
    originalPerspective = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective()
    perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry()
    __perspectiveDesc__ = perspectiveRegistry.createPerspective('tasklet', originalPerspective)
    activatedTasklet = __getActivateTasklet__()
    if not activatedTasklet == None:
        if activatedTasklet.getTasklet().isNewWindow():
            WorkbenchUtils.openEmptyWorkbenchWindow()
    global __mPerspectiveStack__
    __mPerspectiveStack__ = WorkbenchUtils.getActiveMPerspectiveStack()
Example #2
0
def __prepareUI__():
    global __perspectiveDesc__
    originalPerspective = PlatformUI.getWorkbench().getActiveWorkbenchWindow(
    ).getActivePage().getPerspective()
    perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry()
    __perspectiveDesc__ = perspectiveRegistry.createPerspective(
        'tasklet', originalPerspective)
    activatedTasklet = __getActivateTasklet__()
    if not activatedTasklet == None:
        if activatedTasklet.getTasklet().isNewWindow():
            WorkbenchUtils.openEmptyWorkbenchWindow()
    global __mPerspectiveStack__
    __mPerspectiveStack__ = WorkbenchUtils.getActiveMPerspectiveStack()
        def within_display():
            workbench_window = PlatformUI.getWorkbench(
            ).getActiveWorkbenchWindow()

            if hasattr(workbench_window, "getActionBars"):

                bars = workbench_window.getActionBars()
                status_line_manager = bars.getStatusLineManager()
                status_line_manager.setErrorMessage(msg)

                # If this message is still on screen after a timeout, we will clear it
                self.last_error_message = msg

                def clearMessage():
                    #                     print "clearMessage()"
                    if self.last_error_message == msg:
                        #                         print "last message match"
                        print repr(status_line_manager)
                        try:
                            status_line_manager.setErrorMessage(None)
                        except:
                            print "well there was a problem of some kind"
                            print traceback.format_exc()
#                         print "message cleared"

                def clearMessageInDisplay():
                    self.run_in_display(exception_wrap_func(clearMessage))

                threading.Timer(timeout_s, clearMessageInDisplay).start()

            else:
                print "ACTIVE WORKBENCH WINDOW does not have getActionBars()"
        def within_display():
            workbench_window = PlatformUI.getWorkbench(
            ).getActiveWorkbenchWindow()

            assert workbench_window is not None

            menu_bar_manager = workbench_window.getMenuBarManager()
            assert menu_bar_manager is not None
            func(menu_bar_manager)
def go():
    # IFileStore
    
    path = get_buildout_path()
    buildout = os.path.join(path, "buildout.cfg")
    fileToOpen = File(buildout)     
    fileStore = EFS.getLocalFileSystem().getStore(fileToOpen.toURI());
    # IWorkbenchPage
    page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
    IDE.openEditorOnFileStore( page, fileStore );
Example #6
0
def __showView__(view_id, secondary=0):
    """ Display Eclipse view
        @param view_id: View ID
        @param secondary: Optional ID for secondary view 
        @return View
    """
    workbench = PlatformUI.getWorkbench()
    window = workbench.getActiveWorkbenchWindow()
    page = window.getActivePage()
    if secondary > 0:
        return page.showView(view_id, secondary, page.VIEW_ACTIVATE)
    else:
        return page.showView(view_id)
def __showView__(view_id, secondary=0):
    """ Display Eclipse view
        @param view_id: View ID
        @param secondary: Optional ID for secondary view 
        @return View
    """
    workbench = PlatformUI.getWorkbench()
    window = workbench.getActiveWorkbenchWindow()
    page = window.getActivePage()
    if secondary > 0:
        return page.showView(view_id, secondary, page.VIEW_ACTIVATE)
    else:
        return page.showView(view_id)
        def within_display():
            workbench_window = PlatformUI.getWorkbench(
            ).getActiveWorkbenchWindow()

            assert workbench_window is not None
            self.last_workbench_window = workbench_window

            editor = self.get_text_editor()

            #             show_dir(workbench_window)
            if editor is not None:
                selection = editor.getSelectionProvider().getSelection()
                selected_text = selection.getText()
                print "selection: %r" % selected_text
                callback(selected_text)
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.eclipse.ui import PlatformUI

if PVUtil.getDouble(pvs[0]):
    selection_type = PVUtil.getString(pvs[1])
    #if selection_type in ['ch', 'cv', 'fch', 'fcv', 'qs']: selection_type = "Corrector"
    title = selection_type.upper() + ' Selection'
    window = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
    window.getShell().setText(title)
    pvs[0].setValue(0)
Example #10
0
from org.csstudio.opibuilder.scriptUtil import PVUtil, ConsoleUtil
from org.eclipse.ui import PlatformUI

window_title = ['Warning']
windows = PlatformUI.getWorkbench().getWorkbenchWindows()
for w in windows:
    title = w.getShell().getText()
    if title in window_title:
        w.close()
Example #11
0
 def getActiveViewId():
     try:
         return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePartReference().getId()
     except AttributeError, e:
         if "NoneType" not in str(e):
             raise
Example #12
0
    #from org.eclipse.jface.dialogs import MessageDialog
    #MessageDialog.openWarning(
    #        None, "Type", "Type is " + neutrons.__class__.__name__)       
    
    # Create scan
    cmds =[
      Loop('xpos', min(x0, x1), max(x0, x1), max(0.1, abs(dx)),
        Loop('ypos', min(y0, y1), max(y0, y1), toggle * max(0.1, abs(dy)),
        [
           Wait('neutrons', neutrons, comparison='increase by'),
           Log('xpos', 'ypos', 'readback')
        ]
        )
      )
    ]
    
    if simu:
        simulation = scan_client.simulate(cmds)
        SimulationDisplay.show(SimulationResult(simulation['seconds'], simulation['simulation']))
    else:
        # Submit scan
        id = scan_client.submit(cmds, "XY Scan")
        workbench = PlatformUI.getWorkbench()
        window = workbench.getActiveWorkbenchWindow()
        page = window.getActivePage()
        plot = page.showView("org.csstudio.scan.ui.plot.view")
        plot.selectScan("XY Scan", id)
        plot.selectDevices("xpos", "ypos")
except:
    showException("XY Scan")
Example #13
0
File: app.py Project: nxi/gumtree
 def __init__(self):
     self.services = Services()
     self.workbench = PlatformUI.getWorkbench()
Example #14
0
 def __init__(self):
     self.services = Services()
     self.workbench = PlatformUI.getWorkbench()
Example #15
0
    #from org.eclipse.jface.dialogs import MessageDialog
    #MessageDialog.openWarning(
    #        None, "Type", "Type is " + neutrons.__class__.__name__)

    # Create scan
    cmds = [
        Loop(
            'xpos', min(x0, x1), max(x0, x1), max(0.1, abs(dx)),
            Loop('ypos', min(y0, y1), max(y0, y1), toggle * max(0.1, abs(dy)),
                 [
                     Wait('neutrons', neutrons, comparison='increase by'),
                     Log('xpos', 'ypos', 'readback')
                 ]))
    ]

    if simu:
        simulation = scan_client.simulate(cmds)
        SimulationDisplay.show(
            SimulationResult(simulation['seconds'], simulation['simulation']))
    else:
        # Submit scan
        id = scan_client.submit(cmds, "XY Scan")
        workbench = PlatformUI.getWorkbench()
        window = workbench.getActiveWorkbenchWindow()
        page = window.getActivePage()
        plot = page.showView("org.csstudio.scan.ui.plot.view")
        plot.selectScan("XY Scan", id)
        plot.selectDevices("xpos", "ypos")
except:
    showException("XY Scan")