def run(self, ctx): if not isinstance(ctx, IGraphicalClientContext): print('This script must be run within a graphical client') return # show which unit view is currently focused v = ctx.getFocusedView() # needs 2.1.4 print('Focused view: %s' % v) # enumerate all unit views (views representing units) and fragments within those views print('Views and fragments:') views = ctx.getViews() for view in views: print('- %s' % view.getLabel()) fragments = view.getFragments() for fragment in fragments: print(' - %s' % view.getFragmentLabel(fragment)) # focus test if len(views) >= 2: print('Focusing the second Unit view (if any)') views[1].setFocus() # opening the first certificate unit we find (in an APK, there should be one) engctx = ctx.getEnginesContext() projects = engctx.getProjects() unitFilter = UnitFilter('cert') units = RuntimeProjectUtil.filterUnits(projects[0], unitFilter) if units: ctx.openView(units.get(0))
def jumpToTargetFile(self, prj, ctx): unitFilter = UnitFilterByName(self.name + '.xml') unit = RuntimeProjectUtil.filterUnits(prj, unitFilter).get(0) if unit: ctx.openView(unit) return print("*** Cannot find target file ***")
def run(self, ctx): if not isinstance(ctx, IGraphicalClientContext): print('This script must be run within a graphical client') return # show which unit view is currently focused v = ctx.getFocusedView() print('Focused view: %s' % v) # enumerate all unit views (views representing units) and fragments within those views print('Views and fragments:') views = ctx.getViews() for view in views: print('- %s' % view.getLabel()) fragments = view.getFragments() for fragment in fragments: print(' - %s' % view.getFragmentLabel(fragment)) # focus test if len(views) >= 2: print('Focusing the second Unit view (if any)') views[1].setFocus() # opening the first certificate unit we find (in an APK, there should be one) prj = ctx.getMainProject() unitFilter = UnitFilter('cert') units = RuntimeProjectUtil.filterUnits(prj, unitFilter) if units: ctx.openView(units.get(0))
def jumpToTargetFile(self, prj, ctx): unitFilter = UnitFilterByName(self.name + '.xml') unit = RuntimeProjectUtil.filterUnits(prj, unitFilter).get(0) if unit: ctx.openView(unit) return print("*** Cannot find target file ***")