當前位置: 首頁>>代碼示例>>Java>>正文


Java IContentProvider類代碼示例

本文整理匯總了Java中org.eclipse.jface.viewers.IContentProvider的典型用法代碼示例。如果您正苦於以下問題:Java IContentProvider類的具體用法?Java IContentProvider怎麽用?Java IContentProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IContentProvider類屬於org.eclipse.jface.viewers包,在下文中一共展示了IContentProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setFocus

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
@Override
public void setFocus(){
	super.setFocus();
	if (viewer == null) {
		Konsultation selectedKons =
			(Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
		
		viewer = commonViewer.getViewerWidget();
		IContentProvider contentProvider = viewer.getContentProvider();
		if (contentProvider instanceof TarmedCodeSelectorContentProvider) {
			if (selectedKons != null) {
				updateLawFilter(selectedKons);
			}
			viewer.addFilter(lawFilter);
		}
		if (selectedKons != null) {
			updateValidFilter(selectedKons);
		}
		viewer.addFilter(validDateFilter);
		ElexisEventDispatcher.getInstance().addListeners(konsFilter);
	}
	refreshViewer();
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:24,代碼來源:TarmedSelectorPanelProvider.java

示例2: createTableFromData

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
/**
 * Creates a tableviewer from the given provider.
 * 
 * @param parent
 *            Composite that holds the table.
 * @param dataset
 * @param labelProvider
 * @param contentProvider
 * @return Table
 */
public TableViewer createTableFromData(final Composite parent, final DataSet dataset,
		final ILabelProvider labelProvider, final IContentProvider contentProvider) {
	Table table = this.createTable(parent, dataset);

	// Create table viewer and set providers.
	TableViewer tableViewer = new TableViewer(table);

	// Set providers.
	tableViewer.setLabelProvider(labelProvider);
	tableViewer.setContentProvider(contentProvider);

	// Invoke the inputChanged method after a content provider is set.
	tableViewer.setInput(table);

	// add column sorters.
	this.addColumnSort(tableViewer);

	return tableViewer;
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:30,代碼來源:TableFactory.java

示例3: hasUnfilteredChild

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private boolean hasUnfilteredChild(TreeViewer viewer, TreePath parentPath, Object element) {
	TreePath elementPath = parentPath.createChildPath(element);
	IContentProvider contentProvider = viewer.getContentProvider();
	Object[] children = contentProvider instanceof ITreePathContentProvider
			? ((ITreePathContentProvider) contentProvider).getChildren(elementPath)
			: ((ITreeContentProvider) contentProvider).getChildren(element);

	/* avoid NPE + guard close */
	if (children == null || children.length == 0) {
		return false;
	}
	for (int i = 0; i < children.length; i++) {
		if (selectTreePath(viewer, elementPath, children[i])) {
			return true;
		}
	}
	return false;
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:19,代碼來源:AbstractTreeViewerFilter.java

示例4: initViewer

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private static void initViewer(StructuredViewer viewer, ElementTypes elementTypes, Object input,
        IElementBinding elementBinding, IViewerType viewerType, Class<?> contentProviderInterfaceType) {

    PluggableContentProvider pluggableContentProvider = new PluggableContentProvider(viewerType, elementTypes,
            elementBinding);

    ElementTypesLabelProvider labelProvider = new ElementTypesLabelProvider(elementTypes);

    DelegatingInvocationHandler invocationHandler = new DelegatingInvocationHandler(pluggableContentProvider);

    IContentProvider contentProvider = (IContentProvider) Proxy.newProxyInstance(contentProviderInterfaceType
            .getClassLoader(), new Class[] { contentProviderInterfaceType }, invocationHandler);

    viewer.setContentProvider(contentProvider);
    viewer.setLabelProvider(labelProvider);
    viewer.setUseHashlookup(true);
    viewer.setInput(input);
}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:19,代碼來源:ViewerFactory.java

示例5: createContentProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private IContentProvider createContentProvider() {
	return new IStructuredContentProvider() {
		@Override
		public void dispose() {
		}

		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {

		}

		@Override
		public Object[] getElements(Object inputElement) {

			Object model = null;
			if (inputElement instanceof IPointGenerator) {
				IPointGenerator<IScanPathModel> op = (IPointGenerator<IScanPathModel>)inputElement;
				model = op.getModel();
			} else {
				model = inputElement;
			}
			try {
				final Collection<FieldValue>  col = FieldUtils.getModelFields(model);
				return col.toArray(new FieldValue[col.size()]);
			} catch (Exception ne) {
				return new FieldValue[]{};
			}
		}
	};
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:31,代碼來源:ModelViewer.java

示例6: createContentProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private IContentProvider createContentProvider() {
	return new IStructuredContentProvider() {


		private Set<Entry<Object, Object>> entries;

		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
			@SuppressWarnings("unchecked")
			Map<Object,Object> tmp = (Map<Object,Object>)newInput;
			if (tmp==null) return;
			this.entries = tmp.entrySet();
		}

		@Override
		public void dispose() {

		}

		@Override
		public Object[] getElements(Object inputElement) {
			return entries.toArray(new Entry[entries.size()]);
		}
	};
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:26,代碼來源:PropertiesDialog.java

示例7: createContentProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private IContentProvider createContentProvider() {
	return new IStructuredContentProvider() {

		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}

		@Override
		public void dispose() {
			if (consumers!=null) consumers.clear();
		}

		@Override
		public Object[] getElements(Object inputElement) {
			if (consumers==null) return new HeartbeatBean[]{HeartbeatBean.EMPTY};
			final List<HeartbeatBean> beats = new ArrayList<>(consumers.values());
			Collections.sort(beats, new Comparator<HeartbeatBean>() {
				@Override
				public int compare(HeartbeatBean o1, HeartbeatBean o2) {
					return (int)(o2.getConceptionTime()-o1.getConceptionTime());
				}
			});
			return beats.toArray(new HeartbeatBean[consumers.size()]);
		}
	};
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:27,代碼來源:ConsumerView.java

示例8: createContentProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
@SuppressWarnings("squid:S3776")
private IContentProvider createContentProvider() {
	return new IStructuredContentProvider() {
		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
			queue = (Map<String, StatusBean>)newInput;
		}

		@Override
		public void dispose() {
			if (queue!=null) queue.clear();
		}

		@Override
		public Object[] getElements(Object inputElement) {
			if (queue==null) return new StatusBean[]{StatusBean.EMPTY};
			final List<StatusBean> retained = new ArrayList<>(queue.values());

			// This preference is not secure people could hack DAWN to do this.
			if (!Boolean.getBoolean("org.dawnsci.commandserver.ui.view.showWholeQueue")) {
				// Old fashioned loop. In Java8 we will use a predicate...
				final String userName = getUserName();
				for (Iterator it = retained.iterator(); it.hasNext();) {
					StatusBean statusBean = (StatusBean) it.next();
					if (statusBean.getUserName()==null) continue;
					if (hideOtherUsersResults && !userName.equals(statusBean.getUserName())) it.remove();
				}
				// This form of filtering is not at all secure because we
				// give the full list of the queue to the clients.
			}
			return retained.toArray(new StatusBean[retained.size()]);
		}
	};
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:35,代碼來源:StatusQueueView.java

示例9: getContentProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
protected IContentProvider getContentProvider(final boolean undo) {
	return new IStructuredContentProvider() {
		
		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
			//
		}
		
		@Override
		public void dispose() {
			//
		}
		
		@Override
		public Object[] getElements(Object inputElement) {
			ICommandExecutor cmdExecutor = (ICommandExecutor) inputElement;
			if (undo) {
				return cmdExecutor.getUndoableCommandStack().toArray();
			} else {
				return cmdExecutor.getRedoableCommandStack().toArray();
			}
		}
		
	};
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:26,代碼來源:SchemaHistoryView.java

示例10: hasUnfilteredChild

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private boolean hasUnfilteredChild(TreeViewer viewer, TreePath parentPath, Object element) {
	TreePath elementPath = parentPath.createChildPath(element);
	IContentProvider contentProvider = viewer.getContentProvider();
	Object[] children = contentProvider instanceof ITreePathContentProvider
			? ((ITreePathContentProvider) contentProvider).getChildren(elementPath)
			: ((ITreeContentProvider) contentProvider).getChildren(element);

	/* avoid NPE + guard close */
	if (children == null || children.length == 0) {
		return false;
	}

	for (int i = 0; i < children.length; i++) {
		if (selectTreePath(viewer, elementPath, children[i])) {
			return true;
		}
	}
	return false;
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:20,代碼來源:AbstractTreeViewerFilter.java

示例11: setupBranchViewers

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private void setupBranchViewers() {
    final IContentProvider contentProvider = new ContentProviderAdapter() {
        @Override
        public Object[] getElements(final Object input) {
            @SuppressWarnings("unchecked")
            final List<GitBranch> branches = ((List<GitBranch>) input);

            return branches.toArray(new GitBranch[branches.size()]);
        }
    };
    branchViewer.setContentProvider(contentProvider);
    branchComboViewer.setContentProvider(contentProvider);

    final LabelProvider labelProvider = new LabelProvider() {
        @Override
        public String getText(final Object element) {
            return ((GitBranch) element).getRemoteName();
        }
    };
    branchViewer.setLabelProvider(labelProvider);
    branchComboViewer.setLabelProvider(labelProvider);

    final ViewerComparator viewerComparator = new ViewerComparator() {
        @Override
        public int compare(final Viewer viewer, final Object e1, final Object e2) {
            return ((GitBranch) e1).compareTo(((GitBranch) e2));
        }
    };
    branchViewer.setComparator(viewerComparator);
    branchComboViewer.setComparator(viewerComparator);
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:32,代碼來源:GitSourceSettingsControl.java

示例12: ChangePathsTableProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
public ChangePathsTableProvider(Composite parent, IContentProvider contentProvider) {
  super(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
  
  TableLayout layout = new TableLayout();
  GridData data = new GridData(GridData.FILL_BOTH);
  
  Table table = (Table) getControl();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayoutData(data);    
  table.setLayout(layout);
  table.addDisposeListener(new DisposeListener() {
    public void widgetDisposed(DisposeEvent e) {
      if(currentPathFont != null) {
        currentPathFont.dispose();
      }
    }
  });
  
  createColumns(table, layout);
  
  setLabelProvider(new ChangePathLabelProvider());
  setContentProvider(contentProvider);
  
  ChangePathsSorter sorter = new ChangePathsSorter(COL_PATH);
  setSorter(sorter);
  table.setSortDirection(SWT.UP);
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:29,代碼來源:ChangePathsTableProvider.java

示例13: ChangePathsTreeViewer

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
public ChangePathsTreeViewer(Composite parent, IContentProvider contentProvider) {
    super(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI /*| SWT.FULL_SELECTION*/);
    GridData data = new GridData(GridData.FILL_BOTH);
    getControl().setLayoutData(data);
    getControl().addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            if(currentPathFont != null) {
                currentPathFont.dispose();
            }
        }
    });

    setLabelProvider(new ChangePathLabelProvider());
    setContentProvider(contentProvider);
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:16,代碼來源:ChangePathsTreeViewer.java

示例14: createContentProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
protected IContentProvider createContentProvider(AbstractTraceEditor<?> editor, TableViewer logViewerTable, boolean supportsVariableRowHeight){
 ILogMessage root =   ((StaticTraceEditorInput)editor.getEditorInput()).getRoot();
 if (supportsVariableRowHeight)
	 return new DetailedLinuxTableContentProvider(this, root);
 else
	 return new DetailedWindowsTableContentProvider(this, root);
}
 
開發者ID:scauwe,項目名稱:IDM-Enh-Trace,代碼行數:8,代碼來源:DetailedTraceComposite.java

示例15: setContentProvider

import org.eclipse.jface.viewers.IContentProvider; //導入依賴的package包/類
private void setContentProvider(ViewerComparator viewerComparator, IContentProvider contentProvider,
		boolean supportsFilters, boolean supportsPlugins) {
	viewer.setComparator(viewerComparator);
	viewer.setContentProvider(contentProvider);

	setViewerFilterActionsEnabled(supportsFilters);
	showPluginsAction.setEnabled(supportsPlugins);

	if (supportsFilters) {
		resetViewerFilters();
	} else {
		viewer.setFilters(new ViewerFilter[] { patternFilter });
	}
}
 
開發者ID:secondfiddle,項目名稱:pep-tools,代碼行數:15,代碼來源:FeatureExplorerView.java


注:本文中的org.eclipse.jface.viewers.IContentProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。