/** * @param aPart * @param aShowInContext */ public PropertyShowInContext(IWorkbenchPart aPart, ShowInContext aShowInContext) { super(aShowInContext.getInput(), aShowInContext.getSelection()); part = aPart; }
/** * @param aPart * @param aShowInContext */ public PropertyShowInContext(IWorkbenchPart aPart, ShowInContext aShowInContext) { super(aShowInContext.getInput(), aShowInContext.getSelection()); part = aPart; }
public boolean show(ShowInContext context) { ISelection selection = context.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) selection; List<IPath> paths = new ArrayList<IPath>(); for (Iterator it = ss.iterator(); it.hasNext();) { Object element = it.next(); IResource resource = AdapterUtils.adapt(element, IResource.class); if (resource != null) { IPath location = resource.getLocation(); if (location != null) paths.add(location); } else if (element instanceof IPath) paths.add((IPath) element); } if (!paths.isEmpty()) { showPaths(paths); return true; } } if(context.getInput() instanceof IFileEditorInput) { IFileEditorInput input = (IFileEditorInput) context.getInput(); showResource(input.getFile()); } return false; }
@Override public boolean show(ShowInContext context) { ISelection selection = context.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) selection; if (ss.size() == 1) { // If we can show the selection, return. // Otherwise, fall through and attempt to show the input if ((showHistoryFor(ss.getFirstElement()) != null)) return true; } } if (context.getInput() != null) { return (showHistoryFor(context.getInput()) != null); } return false; } }
public boolean show(ShowInContext context) { ISelection selection = context.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) selection; if (ss.size() == 1) { // If we can show the selection, return. // Otherwise, fall through and attempt to show the input if ((showHistoryFor(ss.getFirstElement()) != null)) return true; } } if (context.getInput() != null) { return (showHistoryFor(context.getInput()) != null); } return false; } }
Object input = context.getInput(); if (input != null) { currentState.put(ISources.SHOW_IN_INPUT, input);
Object input = context.getInput(); IResource resource = Adapters.adapt(input, IResource.class); if (resource != null) {
private IStructuredSelection getSelection(ShowInContext context) { if (context == null) return StructuredSelection.EMPTY; ISelection selection = context.getSelection(); if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) return (IStructuredSelection)selection; Object input = context.getInput(); if (input instanceof IEditorInput) { LinkHelperService lhs = getLinkHelperService(); return lhs.getSelectionFor((IEditorInput) input); } if (input != null) { return new StructuredSelection(input); } return StructuredSelection.EMPTY; }
public void updateShowInSources(MPart part) { IWorkbenchPart workbenchPart = getWorkbenchPart(part); ShowInContext context = getContext(workbenchPart); if (context != null) { window.getContext().set(ISources.SHOW_IN_INPUT, context.getInput()); window.getContext().set(ISources.SHOW_IN_SELECTION, context.getSelection()); } }
@Override public boolean show(ShowInContext context) { Object selection = getSingleElement(context.getSelection()); if (selection != null) { // If can show the selection, do it. // Otherwise, fall through and attempt to show the input if (showInput(selection)) return true; } Object input = context.getInput(); if (input != null) { if (input instanceof IEditorInput) { return showInput(getInputFromEditor((IEditorInput) input)); } return showInput(input); } return false; }
@Override public boolean show(ShowInContext context) { ISelection selection= context.getSelection(); if (selection instanceof IStructuredSelection) { // fix for 64634 Navigate/Show in/Package Explorer doesn't work IStructuredSelection structuredSelection= ((IStructuredSelection) selection); if (structuredSelection.size() == 1) { int res= tryToReveal(structuredSelection.getFirstElement()); if (res == IStatus.OK) return true; if (res == IStatus.CANCEL) return false; } else if (structuredSelection.size() > 1) { selectReveal(structuredSelection); return true; } } Object input= context.getInput(); if (input instanceof IEditorInput) { Object elementOfInput= getInputFromEditor((IEditorInput) input); return elementOfInput != null && (tryToReveal(elementOfInput) == IStatus.OK); } return false; }
public boolean show(ShowInContext context) { ISelection selection= context.getSelection(); if (selection instanceof IStructuredSelection) { // fix for 64634 Navigate/Show in/Package Explorer doesn't work IStructuredSelection structuredSelection= ((IStructuredSelection) selection); if (structuredSelection.size() == 1) { int res= tryToReveal(structuredSelection.getFirstElement()); if (res == IStatus.OK) return true; if (res == IStatus.CANCEL) return false; } else if (structuredSelection.size() > 1) { selectReveal(structuredSelection); return true; } } Object input= context.getInput(); if (input instanceof IEditorInput) { Object elementOfInput= getInputFromEditor((IEditorInput) input); return elementOfInput != null && (tryToReveal(elementOfInput) == IStatus.OK); } return false; }
@Override public boolean show(ShowInContext context) { ISelection selection= context.getSelection(); if (selection instanceof IStructuredSelection) { // fix for 64634 Navigate/Show in/Package Explorer doesn't work IStructuredSelection structuredSelection= ((IStructuredSelection) selection); if (structuredSelection.size() == 1) { int res= tryToReveal(structuredSelection.getFirstElement()); if (res == IStatus.OK) return true; if (res == IStatus.CANCEL) return false; } else if (structuredSelection.size() > 1) { selectReveal(structuredSelection); return true; } } Object input= context.getInput(); if (input instanceof IEditorInput) { Object elementOfInput= getInputFromEditor((IEditorInput) input); return elementOfInput != null && (tryToReveal(elementOfInput) == IStatus.OK); } return false; }
return; if (context.getInput() == null && (context.getSelection() == null || context.getSelection() .isEmpty())) {