当前位置: 首页>>代码示例>>Java>>正文


Java BaseWorkbenchContentProvider类代码示例

本文整理汇总了Java中org.eclipse.ui.model.BaseWorkbenchContentProvider的典型用法代码示例。如果您正苦于以下问题:Java BaseWorkbenchContentProvider类的具体用法?Java BaseWorkbenchContentProvider怎么用?Java BaseWorkbenchContentProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BaseWorkbenchContentProvider类属于org.eclipse.ui.model包,在下文中一共展示了BaseWorkbenchContentProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTreeViewer

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
@Override
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
  int style = SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.BORDER
      | SWT.H_SCROLL | SWT.V_SCROLL;
  CheckboxTreeViewer result = new CheckboxTreeViewer(parent, style);
  result.setLabelProvider(new WorkbenchLabelProvider());
  result.setContentProvider(new BaseWorkbenchContentProvider());
  result.setComparator(new NodeWrapperTreeSorter());

  result.addCheckStateListener(new ICheckStateListener() {
    @Override
    public void checkStateChanged(CheckStateChangedEvent event) {
      if (recursiveTreeSelect) {
        tree.setSubtreeChecked(event.getElement(), event.getChecked());
      }
    }
  });

  tree = result;
  return result;
}
 
开发者ID:google,项目名称:depan,代码行数:22,代码来源:CheckNodeTreeView.java

示例2: getContentProvider

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
/**
 * getContentProvider
 * 
 * @return
 */
private IStructuredContentProvider getContentProvider()
{
	return new BaseWorkbenchContentProvider()
	{
		/*
		 * (non-Javadoc)
		 * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#getChildren(java.lang.Object)
		 */
		@Override
		public Object[] getChildren(Object element)
		{
			if (element instanceof Set<?>)
			{
				return ((Set<?>) element).toArray();
			}
			return super.getChildren(element);
		}
	};
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:25,代码来源:ProjectBuildPathPropertyPage.java

示例3: selectInProject

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
private void selectInProject() {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
            new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
    dialog.setTitle("Select a file in the project:");
    dialog.setMessage("Select a file in the project:");
    // Filter to the project
    dialog.addFilter(new ViewerFilter() {
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof IProject) {
                return ((IProject) element).getName().equals(project.getName());
            }
            // we want a folder
            return defaultExtension != null || element instanceof IContainer;
        }
    });
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
    // TODO try to preselect the current file
    dialog.open();
    Object[] results = dialog.getResult();
    if ((results != null) && (results.length > 0) && (results[0] instanceof IResource)) {
        IPath path = ((IResource) results[0]).getFullPath();
        setProjectLoc(path.removeFirstSegments(1).makeRelative().toString());
    }
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:25,代码来源:PathEditor.java

示例4: showSaveDirtyFileDialog

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
private static boolean showSaveDirtyFileDialog(
		List<IEditorPart> dirtyEditors )
{
	AdaptableList input = new AdaptableList( dirtyEditors );

	ListDialog dlg = new ListDialog( PlatformUI.getWorkbench( )
			.getActiveWorkbenchWindow( )
			.getShell( ) );
	dlg.setContentProvider( new BaseWorkbenchContentProvider( ) );
	dlg.setLabelProvider( new WorkbenchPartLabelProvider( ) );
	dlg.setInput( input );
	dlg.setMessage( Messages.getString( "renameChecker.saveResourcesMessage" ) ); //$NON-NLS-1$
	dlg.setTitle( Messages.getString( "renameChecker.saveResourcesTitle" ) ); //$NON-NLS-1$

	// Just return false to prevent the operation continuing
	return dlg.open( ) == IDialogConstants.OK_ID;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:ResourceCloseManagement.java

示例5: selectFolderInProject

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
private IFolder selectFolderInProject() {
	ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(),
			new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
	dialog.setTitle("Select View Root");
	dialog.setMessage("select the view root:");
	dialog.setInput(getProject());
	dialog.addFilter(new ViewerFilter() {

		public boolean select(Viewer viewer, Object parentElement, Object element) {
			return element instanceof IFolder && ((IFolder) element).isAccessible();
		}
	});
	if (Window.OK == dialog.open()) {
		Object[] result = dialog.getResult();
		if (result.length > 0) {
			return (IFolder) result[0];
		}
	}
	return null;
}
 
开发者ID:cntoplolicon,项目名称:seasar2-assistant,代码行数:21,代码来源:Seasar2AssistantPropertyPage.java

示例6: addAddBtn

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
protected void addAddBtn(final Composite btnComposite) {
	Button add = new Button(btnComposite, SWT.FLAT);
	GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).applyTo(add);
	add.setText("Add...");
	add.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			super.widgetSelected(e);
			ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(btnComposite.getShell(),
					new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());

			dialog.setValidator(new CheaderBlacklistSelectionStatusValidator());

			dialog.setTitle("Add blacklist item");
			dialog.setMessage("Select a blacklist item:");
			dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
			dialog.addFilter(new CHeaderViewerFilter(getActualProject()));

			if (!values.isEmpty())
				dialog.setInitialSelection(values.get(values.size() - 1));

			dialog.setDialogBoundsSettings(BuilderActivator.getDefault().getDialogSettings(),
					Dialog.DIALOG_PERSISTLOCATION);
			dialog.open();
			Object[] result = dialog.getResult();
			if (result != null) {
				for (Object selection : result) {
					if (selection instanceof IResource) {
						values.add((IResource) selection);
					}
				}
				blackListViewer.refresh();
			}
		}
	});

}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:38,代码来源:BuilderPropertyPage.java

示例7: modelPropertyChange

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void modelPropertyChange(PropertyChangeEvent evt) {
	if (evt.getPropertyName().equals(
			ControllerProperties.PROJECTLIST_PROPERTY.getProperty())) {
		root = new ProjectRoot((ArrayList<IProject>) evt.getNewValue());
		deltaController.getChanges(selectedfilePatch);
	} else if (evt.getPropertyName().equals(
			ControllerProperties.UNIFIEDDIFF_PROPERTY.getProperty())) {
		ProjectSelectionDialog dlg = new ProjectSelectionDialog(viewer
				.getControl().getShell(), root,
				new BaseWorkbenchContentProvider(),
				new WorkbenchLabelProvider(),
				"Select the project to be synchronized:",
				(String) evt.getNewValue());
		dlg.setTitle("Project Selection");
		dlg.open();
		Object[] result = dlg.getResult();
		if (result != null && result.length > 0) {
			synchronizationController
					.synchronize(result, selectedfilePatch);
		}
	} else if (evt.getPropertyName().equals(
			ControllerProperties.REFRESHTREE_PROPERTY.getProperty())) {
		refreshTree();
	}
}
 
开发者ID:1Tristan,项目名称:VariantSync,代码行数:28,代码来源:ResourceChangesView.java

示例8: createTreeViewer

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
/**
 * Can be overridden to provide a customized tree viewer.
 * For example, the derived type {@link CheckNodeTreeView}
 * uses a {@code CheckboxTreeViewer}.
 */
protected TreeViewer createTreeViewer(Composite parent) {
  int style = SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.BORDER
      | SWT.H_SCROLL | SWT.V_SCROLL;
  TreeViewer result = new TreeViewer(parent, style);
  result.setLabelProvider(new WorkbenchLabelProvider());
  result.setContentProvider(new BaseWorkbenchContentProvider());
  result.setComparator(SORTER);

  setupHierarchyMenu(result);

  return result;
}
 
开发者ID:google,项目名称:depan,代码行数:18,代码来源:GraphNodeViewer.java

示例9: getContentProvider

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
/**
 * Returns a content provider for the list dialog. The content provider will include all available natures as
 * strings.
 * 
 * @return the content provider that shows the natures (as string children)
 */
private IStructuredContentProvider getContentProvider()
{
	return new BaseWorkbenchContentProvider()
	{
		@Override
		public Object[] getChildren(Object o)
		{
			if (!(o instanceof IWorkspace))
			{
				return new Object[0];
			}
			Set<String> elements = new HashSet<String>();
			// collect all available natures in the workspace
			IProjectNatureDescriptor[] natureDescriptors = ((IWorkspace) o).getNatureDescriptors();
			String natureId;
			for (IProjectNatureDescriptor descriptor : natureDescriptors)
			{
				natureId = descriptor.getNatureId();
				if (natureId != null)
				{
					if (ResourceUtil.isAptanaNature(natureId))
					{
						elements.add(natureId);
						fNatureDescriptions.put(natureId, descriptor.getLabel());
					}
				}
			}
			return elements.toArray();
		}
	};
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:38,代码来源:WizardFolderImportPage.java

示例10: createFileDialog

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
private ResourceFileSelectionDialog createFileDialog(String title, Object selection) {
	ResourceFileSelectionDialog diag = new ResourceFileSelectionDialog(getShell(), 
			new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
	
	configureDialog(diag, title, "Select Folder", selection);
	
	return diag;
}
 
开发者ID:gossi,项目名称:eclipse-transpiler-plugin,代码行数:9,代码来源:PathDialog.java

示例11: createFolderDialog

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
private ElementTreeSelectionDialog createFolderDialog(String title, Object selection) {
	ElementTreeSelectionDialog diag = new ElementTreeSelectionDialog(getShell(), 
			new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
	
	diag.addFilter(new TypedViewerFilter(new Class[]{IFolder.class}));
	configureDialog(diag, title, "Select Folder", selection);
	
	return diag;
}
 
开发者ID:gossi,项目名称:eclipse-transpiler-plugin,代码行数:10,代码来源:PathDialog.java

示例12: selectInWorkspace

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
private void selectInWorkspace() {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
            new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
    dialog.setTitle("Select a file in the workspace:");
    dialog.setMessage("Select a file in the workspace:");
    // Filter closed projects
    dialog.addFilter(new ViewerFilter() {
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof IProject) {
                return ((IProject) element).isAccessible();
            }
            // we want a folder
            return defaultExtension != null || element instanceof IContainer;
        }
    });
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
    // TODO try to preselect the current file
    dialog.open();
    Object[] results = dialog.getResult();
    if (results != null && results.length > 0 && results[0] instanceof IResource) {
        IPath path = ((IResource) results[0]).getFullPath();
        if (project != null && path.segment(0).equals(project.getProject().getName())) {
            setProjectLoc(path.removeFirstSegments(1).makeRelative().toString());
        } else {
            String containerName = path.makeRelative().toString();
            setWorkspaceLoc("${workspace_loc:" + containerName + "}");
        }
    }
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:30,代码来源:PathEditor.java

示例13: getOperatorTypeCreationDialog

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
public static MIDTreeSelectionDialog getOperatorTypeCreationDialog(MID typeMID) {

		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
		MIDTreeSelectionDialog dialog = new MIDTreeSelectionDialog(
			shell,
			new WorkbenchLabelProvider(),
			new BaseWorkbenchContentProvider(),
			ResourcesPlugin.getWorkspace().getRoot()
		);
		dialog.addFilter(new NewOperatorTypeDialogFilter());
		dialog.setValidator(new NewOperatorTypeDialogSelectionValidator());

		return dialog;
	}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:15,代码来源:MIDTypeRegistry.java

示例14: getModelImportDialog

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
/**
 * Gets a tree dialog that shows all model files in the workspace, in order
 * to import an existing model.
 *
 * @return The tree dialog to import an existing model.
 */
public static MIDTreeSelectionDialog getModelImportDialog() {

	Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
	MIDTreeSelectionDialog dialog = new MIDTreeSelectionDialog(
		shell,
		new WorkbenchLabelProvider(),
		new BaseWorkbenchContentProvider(),
		ResourcesPlugin.getWorkspace().getRoot()
	);
	dialog.addFilter(new ImportModelDialogFilter());
	dialog.setValidator(new ImportModelDialogSelectionValidator());

	return dialog;
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:21,代码来源:MIDTypeRegistry.java

示例15: openFolderDialog

import org.eclipse.ui.model.BaseWorkbenchContentProvider; //导入依赖的package包/类
private PathListElement[] openFolderDialog(PathListElement existing) {

        Class[] acceptedClasses = new Class[] { IProject.class, IFolder.class };
        List existingContainers = getExistingContainers(null);

        IProject[] allProjects = workspaceRoot.getProjects();
        ArrayList rejectedElements = new ArrayList(allProjects.length);
        IProject currProject = project;
        for (int i = 0; i < allProjects.length; i++) {
            if (!allProjects[i].equals(currProject)) {
                rejectedElements.add(allProjects[i]);
            }
        }
        ViewerFilter filter = new TypedViewerFilter(acceptedClasses, rejectedElements
                .toArray());

        ILabelProvider lp = new WorkbenchLabelProvider();
        ITreeContentProvider cp = new BaseWorkbenchContentProvider();

        String title = "Folder Selection";
        String message = "&Choose folders to be added to the synchronization mapping:";

        MultipleFolderSelectionDialog dialog = new MultipleFolderSelectionDialog(
                getShell(), lp, cp);
        dialog.setExisting(existingContainers.toArray());
        dialog.setTitle(title);
        dialog.setMessage(message);
        dialog.addFilter(filter);
        dialog.setInput(project.getParent());
        if (existing == null) {
            dialog.setInitialFocus(project);
        } else {
            dialog.setInitialFocus(existing.getResource());
        }
        if (dialog.open() == Window.OK) {
            Object[] elements = dialog.getResult();
            PathListElement[] res = new PathListElement[elements.length];
            for (int i = 0; i < res.length; i++) {
                IResource elem = (IResource) elements[i];
                res[i] = newFolderElement(elem);
            }
            return res;
        }
        return null;
    }
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:46,代码来源:ProjectSyncPropertyPage.java


注:本文中的org.eclipse.ui.model.BaseWorkbenchContentProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。