Java 类org.eclipse.ui.part.IShowInTarget 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:JavaOutlinePage.java   
public Object getAdapter(Class key) {
    if (key == IShowInSource.class) {
        return getShowInSource();
    }
    if (key == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { JavaUI.ID_PACKAGES };
            }

        };
    }
    if (key == IShowInTarget.class) {
        return getShowInTarget();
    }

    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaOutlinePage.java   
/**
 * Returns the <code>IShowInTarget</code> for this view.
 *
 * @return the {@link IShowInTarget}
 */
protected IShowInTarget getShowInTarget() {
    return new IShowInTarget() {
        public boolean show(ShowInContext context) {
            ISelection sel= context.getSelection();
            if (sel instanceof ITextSelection) {
                ITextSelection tsel= (ITextSelection) sel;
                int offset= tsel.getOffset();
                IJavaElement element= fEditor.getElementAt(offset);
                if (element != null) {
                    setSelection(new StructuredSelection(element));
                    return true;
                }
            } else if (sel instanceof IStructuredSelection) {
                setSelection(sel);
                return true;
            }
            return false;
        }
    };
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaOutlinePage.java   
public Object getAdapter(Class key) {
    if (key == IShowInSource.class) {
        return getShowInSource();
    }
    if (key == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { JavaUI.ID_PACKAGES };
            }

        };
    }
    if (key == IShowInTarget.class) {
        return getShowInTarget();
    }

    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaOutlinePage.java   
/**
 * Returns the <code>IShowInTarget</code> for this view.
 *
 * @return the {@link IShowInTarget}
 */
protected IShowInTarget getShowInTarget() {
    return new IShowInTarget() {
        public boolean show(ShowInContext context) {
            ISelection sel= context.getSelection();
            if (sel instanceof ITextSelection) {
                ITextSelection tsel= (ITextSelection) sel;
                int offset= tsel.getOffset();
                IJavaElement element= fEditor.getElementAt(offset);
                if (element != null) {
                    setSelection(new StructuredSelection(element));
                    return true;
                }
            } else if (sel instanceof IStructuredSelection) {
                setSelection(sel);
                return true;
            }
            return false;
        }
    };
}
项目:goclipse    文件:LangOutlinePage.java   
protected IShowInTarget getShowInTarget() {
    return new IShowInTarget() {
        @Override
        public boolean show(ShowInContext context) {
            StructureElement structureElement = getStructureElementFor(context.getSelection());

            if(structureElement != null) {
                setSelection(new StructuredSelection(structureElement));
                return true;
            }

            return false;
        }

    };
}
项目:KaiZen-OpenAPI-Editor    文件:DocumentUtils.java   
/**
 * Opens the editor for the file located at the given path and reveal the selection.
 * 
 * @param path
 * @param selection
 */
public static void openAndReveal(IPath path, ISelection selection) {
    final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    final IFile file = root.getFile(path);
    final IEditorPart editor = openEditor(file);

    if (editor instanceof IShowInTarget) {
        IShowInTarget showIn = (IShowInTarget) editor;
        showIn.show(new ShowInContext(null, selection));
    }
}
项目:chromedevtools    文件:TemporarilyFormatSourceAction.java   
private void highlightResult(final VmResource formattedResource,
    final IWorkbenchPart workbenchPart, Shell shell) {
  shell.getDisplay().asyncExec(new Runnable() {
    public void run() {
      if (workbenchPart instanceof IShowInTarget) {
        IShowInTarget showInTarget = (IShowInTarget) workbenchPart;
        ShowInContext showInContext =
            new ShowInContext(formattedResource.getVProjectFile(), null);
        showInTarget.show(showInContext);
      } else {
        openFileInEditorAsync(formattedResource, workbenchPart.getSite().getWorkbenchWindow());
      }
    }
  });
}
项目:Pydev    文件:BaseOutlinePage.java   
@Override
public Object getAdapter(Class adapter) {
    if (adapter == IShowInTarget.class) {
        return this;
    }
    return null;
}
项目:goclipse    文件:LangOutlinePage.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> adapter) {
    if(adapter == IShowInTarget.class) {
        return (T) getShowInTarget();
    }

    return null;
}
项目:KaiZen-OpenAPI-Editor    文件:JsonContentOutlinePage.java   
public JsonContentOutlinePage(IDocumentProvider documentProvider, IShowInTarget showInTarget) {
    super();
    this.documentProvider = documentProvider;
    this.showInTarget = showInTarget;
}
项目:fluentmark    文件:FluentMkSourceViewerConfiguration.java   
/**
 * provide a {@link IShowInTarget show in target} to connect the quick-outline popup with the
 * editor.
 */
public IShowInTarget getShowInTarget() {
    return showInTarget;
}
项目:fluentmark    文件:FluentMkSourceViewerConfiguration.java   
/**
 * provide a {@link IShowInTarget show in target} to connect the quick-outline popup with the
 * editor.
 */
public void setShowInTarget(IShowInTarget showInTarget) {
    this.showInTarget = showInTarget;
}