org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin Java Examples

The following examples show how to use org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin. 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: WorkingSetRootModeActionGroup.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
private IAction[] createActions() {

		ISharedImages sharedImages = PlatformUI.getWorkbench()
				.getSharedImages();

		projectsAction = new TopLevelContentAction(false);
		projectsAction
				.setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Project_);
		projectsAction.setImageDescriptor(sharedImages
				.getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT));

		workingSetsAction = new TopLevelContentAction(true);
		workingSetsAction
				.setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Working_Set_);
		workingSetsAction.setImageDescriptor(WorkbenchNavigatorPlugin
				.getDefault().getImageRegistry().getDescriptor(
						"full/obj16/workingsets.gif")); //$NON-NLS-1$

		return new IAction[] { projectsAction, workingSetsAction };
	}
 
Example #2
Source File: TabbedPropertySheetTitleProvider.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor for CommonNavigatorTitleProvider.
 */
public TabbedPropertySheetTitleProvider() {
	super();
	IWorkbenchPart part = PlatformUI.getWorkbench()
			.getActiveWorkbenchWindow().getActivePage().findView(ProjectExplorer.VIEW_ID);

	INavigatorContentService contentService = (INavigatorContentService) part
			.getAdapter(INavigatorContentService.class);

	if (contentService != null) {
		labelProvider = contentService.createCommonLabelProvider();
		descriptionProvider = contentService
				.createCommonDescriptionProvider();
	} else {
		WorkbenchNavigatorPlugin.log(
				"Could not acquire INavigatorContentService from part (\"" //$NON-NLS-1$
						+ part.getTitle() + "\").", null); //$NON-NLS-1$
	}
}
 
Example #3
Source File: ResourceExtensionContentProvider.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean hasChildren(Object element) {
	try {
		if (element instanceof IContainer) {
			IContainer c = (IContainer) element;
			if (!c.isAccessible())
				return false;
			return c.members().length > 0;
		}
	} catch (CoreException ex) {
		WorkbenchNavigatorPlugin.getDefault().getLog().log(
				new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.PLUGIN_ID, 0, ex.getMessage(), ex));
		return false;
	}

	return super.hasChildren(element);
}
 
Example #4
Source File: WorkingSetRootModeActionGroup.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private IAction[] createActions() {

		ISharedImages sharedImages = PlatformUI.getWorkbench()
				.getSharedImages();

		projectsAction = new TopLevelContentAction(false);
		projectsAction
				.setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Project_);
		projectsAction.setImageDescriptor(sharedImages
				.getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT));

		workingSetsAction = new TopLevelContentAction(true);
		workingSetsAction
				.setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Working_Set_);
		workingSetsAction.setImageDescriptor(WorkbenchNavigatorPlugin
				.getDefault().getImageRegistry().getDescriptor(
						"full/obj16/workingsets.gif")); //$NON-NLS-1$

		return new IAction[] { projectsAction, workingSetsAction };
	}
 
Example #5
Source File: TabbedPropertySheetTitleProvider.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor for CommonNavigatorTitleProvider.
 */
public TabbedPropertySheetTitleProvider() {
	super();
	IWorkbenchPart part = PlatformUI.getWorkbench()
			.getActiveWorkbenchWindow().getActivePage().findView(ProjectExplorer.VIEW_ID);

	INavigatorContentService contentService = (INavigatorContentService) part
			.getAdapter(INavigatorContentService.class);

	if (contentService != null) {
		labelProvider = contentService.createCommonLabelProvider();
		descriptionProvider = contentService
				.createCommonDescriptionProvider();
	} else {
		WorkbenchNavigatorPlugin.log(
				"Could not acquire INavigatorContentService from part (\"" //$NON-NLS-1$
						+ part.getTitle() + "\").", null); //$NON-NLS-1$
	}
}
 
Example #6
Source File: ResourceExtensionContentProvider.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean hasChildren(Object element) {
	try {
		if (element instanceof IContainer) {
			IContainer c = (IContainer) element;
			if (!c.isAccessible())
				return false;
			return c.members().length > 0;
		}
	} catch (CoreException ex) {
		WorkbenchNavigatorPlugin.getDefault().getLog().log(
				new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.PLUGIN_ID, 0, ex.getMessage(), ex));
		return false;
	}

	return super.hasChildren(element);
}
 
Example #7
Source File: PortingActionProvider.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the image descriptor with the given relative path.
 */
protected ImageDescriptor getImageDescriptor(String relativePath) {
	String iconPath = "icons/full/"; //$NON-NLS-1$ 
	URL url = FileLocator.find(WorkbenchNavigatorPlugin.getDefault().getBundle(), new Path(iconPath + relativePath), Collections.EMPTY_MAP);
	if (url == null) {
		return ImageDescriptor.getMissingImageDescriptor();
	}
	return ImageDescriptor.createFromURL(url);
}
 
Example #8
Source File: PortingActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the image descriptor with the given relative path.
 */
protected ImageDescriptor getImageDescriptor(String relativePath) {
	String iconPath = "icons/full/"; //$NON-NLS-1$ 
	URL url = FileLocator.find(WorkbenchNavigatorPlugin.getDefault().getBundle(), new Path(iconPath + relativePath), Collections.EMPTY_MAP);
	if (url == null) {
		return ImageDescriptor.getMissingImageDescriptor();
	}
	return ImageDescriptor.createFromURL(url);
}