org.eclipse.ui.part.IShowInTargetList Java Examples

The following examples show how to use org.eclipse.ui.part.IShowInTargetList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessDiagramEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @generated BonitaSoft
 */
public Object getAdapter(Class type) {
	if (type == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { ProjectExplorer.VIEW_ID };
			}
		};
	}

	if (type == IContentOutlinePage.class) {

		TreeViewer viewer = new TreeViewer();
		viewer.setRootEditPart(new DiagramRootTreeEditPart());
		outlinePage = new DiagramOutlinePage(viewer);
		return outlinePage;
	}

	return super.getAdapter(type);
}
 
Example #2
Source File: AbstractLangStructureEditor.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> requestedClass) {
	if (IContentOutlinePage.class.equals(requestedClass)) {
		IContentOutlinePage outlinePage = this.outlinePage; 
		return (T) outlinePage;
	}
	if(requestedClass == IShowInTargetList.class) {
		return (T) new IShowInTargetList() {
			@Override
			public String[] getShowInTargetIds() {
				return array(IPageLayout.ID_OUTLINE);
			}
		};
	}
	return super.getAdapter(requestedClass);
}
 
Example #3
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object getAdapter(Class key) {
	if (key.equals(ISelectionProvider.class))
		return fViewer;
	if (key == IShowInSource.class) {
		return getShowInSource();
	}
	if (key == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaPlugin.ID_RES_NAV };
			}

		};
	}
	if (key == IContextProvider.class) {
		return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.PACKAGES_VIEW);
	}
	return super.getAdapter(key);
}
 
Example #4
Source File: CallHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
   @Override
public Object getAdapter(Class adapter) {
   	if (adapter == IShowInSource.class) {
   		return getShowInSource();
   	}
   	if (adapter == IContextProvider.class) {
   		return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.CALL_HIERARCHY_VIEW);
   	}
	if (adapter == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaUI.ID_PACKAGES, JavaPlugin.ID_RES_NAV };
			}
		};
	}
   	return super.getAdapter(adapter);
   }
 
Example #5
Source File: JavaOutlinePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: TypeHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
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, JavaPlugin.ID_RES_NAV  };
			}

		};
	}
	if (key == IContextProvider.class) {
		return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.TYPE_HIERARCHY_VIEW);
	}
	return super.getAdapter(key);
}
 
Example #7
Source File: XtendEditorAdapterFactory.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
	if (adaptableObject instanceof XtendEditor && IShowInTargetList.class.equals(adapterType)) {
		return adapterType.cast(new IShowInTargetList() {
			@Override
			public String[] getShowInTargetIds() {
				return new String[] { DerivedSourceView.class.getName() };
			}
		});
	}
	return null;
}
 
Example #8
Source File: FileSearchPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> adapter) {
    if (IShowInTargetList.class.equals(adapter)) {
        return (T) SHOW_IN_TARGET_LIST;
    }
    return null;
}
 
Example #9
Source File: AbstractSearchIndexResultPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter(Class<?> adapter) {
    if (IShowInTargetList.class.equals(adapter)) {
        return SHOW_IN_TARGET_LIST;
    }

    if (adapter == IShowInSource.class) {
        ISelectionProvider selectionProvider = getSite().getSelectionProvider();
        if (selectionProvider == null) {
            return null;
        }

        ISelection selection = selectionProvider.getSelection();
        if (selection instanceof IStructuredSelection) {
            IStructuredSelection structuredSelection = ((StructuredSelection) selection);
            final Set<Object> newSelection = new HashSet<>(structuredSelection.size());
            Iterator<?> iter = structuredSelection.iterator();
            while (iter.hasNext()) {
                Object element = iter.next();
                if (element instanceof ICustomLineElement) {
                    element = ((ICustomLineElement) element).getParent();
                }
                newSelection.add(element);
            }

            return new IShowInSource() {
                @Override
                public ShowInContext getShowInContext() {
                    return new ShowInContext(null, new StructuredSelection(new ArrayList<>(newSelection)));
                }
            };
        }
        return null;
    }

    return null;
}
 
Example #10
Source File: PackagesView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Class key) {
	if (key == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaUI.ID_PACKAGES, JavaPlugin.ID_RES_NAV  };
			}
		};
	}
	return super.getAdapter(key);
}
 
Example #11
Source File: TypesView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Class key) {
	if (key == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaUI.ID_PACKAGES, JavaPlugin.ID_RES_NAV };
			}

		};
	}
	return super.getAdapter(key);
}
 
Example #12
Source File: MembersView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Class key) {
	if (key == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaUI.ID_PACKAGES };
			}

		};
	}
	return super.getAdapter(key);
}
 
Example #13
Source File: ProjectsView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Class key) {
	if (key == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaUI.ID_PACKAGES, JavaPlugin.ID_RES_NAV  };
			}

		};
	}
	return super.getAdapter(key);
}
 
Example #14
Source File: PropertiesFileEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object getAdapter(Class adapter) {
	if (adapter == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaUI.ID_PACKAGES, JavaPlugin.ID_RES_NAV };
			}

		};
	}
	return super.getAdapter(adapter);
}
 
Example #15
Source File: TypeScriptSearchResultPage.java    From typescript.java with MIT License 5 votes vote down vote up
public Object getAdapter(Class adapter) {
	if (IShowInTargetList.class.equals(adapter)) {
		return SHOW_IN_TARGET_LIST;
	}

	if (adapter == IShowInSource.class) {
		ISelectionProvider selectionProvider= getSite().getSelectionProvider();
		if (selectionProvider == null)
			return null;

		ISelection selection= selectionProvider.getSelection();
		if (selection instanceof IStructuredSelection) {
			IStructuredSelection structuredSelection= ((StructuredSelection)selection);
			final Set newSelection= new HashSet(structuredSelection.size());
			Iterator iter= structuredSelection.iterator();
			while (iter.hasNext()) {
				Object element= iter.next();
				if (element instanceof LineElement)
					element= ((LineElement)element).getParent();
				newSelection.add(element);
			}

			return new IShowInSource() {
				public ShowInContext getShowInContext() {
					return new ShowInContext(null, new StructuredSelection(new ArrayList(newSelection)));
				}
			};
		}
		return null;
	}

	return null;
}
 
Example #16
Source File: CrossflowDiagramEditor.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
	if (type == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { ProjectExplorer.VIEW_ID };
			}
		};
	}
	return super.getAdapter(type);
}
 
Example #17
Source File: JavaEditor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Object getAdapter(Class required) {

	if (IContentOutlinePage.class.equals(required)) {
		if (fOutlinePage == null && getSourceViewer() != null && isCalledByOutline())
			fOutlinePage= createOutlinePage();
		return fOutlinePage;
	}

	if (IEncodingSupport.class.equals(required))
		return fEncodingSupport;

	if (required == IShowInTargetList.class) {
		return new IShowInTargetList() {
			public String[] getShowInTargetIds() {
				return new String[] { JavaUI.ID_PACKAGES, IPageLayout.ID_OUTLINE, JavaPlugin.ID_RES_NAV };
			}

		};
	}

	if (required == IShowInSource.class) {
		IJavaElement inputJE= getInputJavaElement();
		if (inputJE instanceof ICompilationUnit && !JavaModelUtil.isPrimary((ICompilationUnit) inputJE))
			return null;

		return new IShowInSource() {
			public ShowInContext getShowInContext() {
				return new ShowInContext(null, null) {
					/*
					 * @see org.eclipse.ui.part.ShowInContext#getInput()
					 * @since 3.4
					 */
					@Override
					public Object getInput() {
						if (isBreadcrumbActive())
							return null;

						return getEditorInput();
					}

					/*
					 * @see org.eclipse.ui.part.ShowInContext#getSelection()
					 * @since 3.3
					 */
					@Override
					public ISelection getSelection() {
						if (isBreadcrumbActive())
							return getBreadcrumb().getSelectionProvider().getSelection();

						try {
							IJavaElement je= SelectionConverter.getElementAtOffset(JavaEditor.this);
							if (je != null)
								return new StructuredSelection(je);
							return null;
						} catch (JavaModelException ex) {
							return null;
						}
					}
				};
			}
		};
	}

	if (required == IJavaFoldingStructureProvider.class)
		return fProjectionModelUpdater;

	if (fProjectionSupport != null) {
		Object adapter= fProjectionSupport.getAdapter(getSourceViewer(), required);
		if (adapter != null)
			return adapter;
	}

	if (required == IContextProvider.class) {
		if (isBreadcrumbActive()) {
			return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.JAVA_EDITOR_BREADCRUMB);
		} else {
			return JavaUIHelp.getHelpContextProvider(this, IJavaHelpContextIds.JAVA_EDITOR);
		}
	}

	return super.getAdapter(required);
}
 
Example #18
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public Object getAdapter(Class adapter) {
	if (IShowInTargetList.class.equals(adapter)) {
		return SHOW_IN_TARGET_LIST;
	}
	return null;
}
 
Example #19
Source File: NLSSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public Object getAdapter(Class adapter) {
	if (IShowInTargetList.class.equals(adapter)) {
		return JavaSearchResultPage.SHOW_IN_TARGET_LIST;
	}
	return null;
}
 
Example #20
Source File: XtendEditorAdapterFactory.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<?>[] getAdapterList() {
	return new Class[] { IShowInTargetList.class };
}