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


Java TreeViewer.setInput方法代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.TreeViewer.setInput方法的典型用法代码示例。如果您正苦于以下问题:Java TreeViewer.setInput方法的具体用法?Java TreeViewer.setInput怎么用?Java TreeViewer.setInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.viewers.TreeViewer的用法示例。


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

示例1: initContextualView

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
private void initContextualView(IEditorPart editor) {
  if (editor == null) {
    return;
  }
  IFile file = editor.getEditorInput().getAdapter(IFile.class);
  TreeViewer treeViewer = ContextualView.getTreeViewer();
  if (treeViewer != null) {
    // Finding all markers in given file.
    ArrayList<IMarker> allMarkers;
    allMarkers = MarkerFactory.findMarkersAsArrayList(file);
    if (allMarkers == null) {
      return;
    }
    Iterator<IMarker> iter = allMarkers.iterator();
    while (iter.hasNext()) {
      IMarker marker = iter.next();
      if (MarkUtilities.getLeaderId(marker) == null && MarkUtilities.getGroupId(marker) != null) {
        iter.remove();
      }
    }
    if (!treeViewer.getTree().isDisposed()) {
      treeViewer.setInput(allMarkers.toArray());
    }
    treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:27,代码来源:Startup.java

示例2: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NONE);
  setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new SigTypeLabelProvider());
  treeViewer.setContentProvider(new SigTypeContentProvider());
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
        selection = event.getSelection();
        ContainerSelectionPage.this.setPageComplete(true);
      } else {
        ContainerSelectionPage.this.setPageComplete(false);
      }
    }
  });
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:26,代码来源:ContainerSelectionPage.java

示例3: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NONE);
  this.setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  TreeViewer treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider());
  treeViewer.setContentProvider(new CreatingAtomWizardContentProvider());
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
  treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()});

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
        UntypedMarkerPage.this.selection = event.getSelection();
        UntypedMarkerPage.this.setPageComplete(true);
      } else {
        UntypedMarkerPage.this.setPageComplete(false);
      }
    }
  });
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:27,代码来源:UntypedMarkerPage.java

示例4: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
public void createControl(Composite parent) {
	super.createControl(parent);

	labelProvider = new BatchEditorOutlineLabelProvider();

	TreeViewer viewer = getTreeViewer();
	viewer.setContentProvider(contentProvider);
	viewer.addDoubleClickListener(this);
	viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
	viewer.addSelectionChangedListener(this);

	/* it can happen that input is already updated before control created */
	if (input != null) {
		viewer.setInput(input);
	}
	toggleLinkingAction = new ToggleLinkingAction();
	toggleLinkingAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR);
	
	IActionBars actionBars = getSite().getActionBars();
	
	IToolBarManager toolBarManager = actionBars.getToolBarManager();
	toolBarManager.add(toggleLinkingAction);
	
	IMenuManager viewMenuManager = actionBars.getMenuManager();
	viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$

	viewMenuManager.add(new Separator("treeGroup")); //$NON-NLS-1$
	viewMenuManager.add(toggleLinkingAction);
	
	
	/*
	 * when no input is set on init state - let the editor rebuild outline
	 * (async)
	 */
	if (input == null && editor != null) {
		editor.rebuildOutline();
	}

}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:40,代码来源:BatchEditorContentOutlinePage.java

示例5: rebuild

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
public void rebuild(BatchScriptModel model) {
	if (model == null) {
		return;
	}
	contentProvider.rebuildTree(model);

	TreeViewer treeViewer = getTreeViewer();
	if (treeViewer != null) {
		Control control = treeViewer.getControl();
		if (control == null || control.isDisposed()){
			return;
		}
		treeViewer.setInput(model);
	}
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:16,代码来源:BatchEditorContentOutlinePage.java

示例6: initialize

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
private void initialize() {
	setLayout(new FillLayout());
	viewer = new TreeViewer(this);
	viewer.setContentProvider(this);
	viewer.setLabelProvider(this);
	viewer.setInput(getInitalInput());
	viewer.expandAll();
	viewer.addSelectionChangedListener(this);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:10,代码来源:NamedSourceSelectorEditorComposite.java

示例7: initialize

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
private void initialize() {
	setLayout(new FillLayout());
	screenClasses = new TreeViewer(this);
	screenClasses.setContentProvider(this);
	screenClasses.setLabelProvider(this);
	screenClasses.setInput(getInitalInput());
	screenClasses.expandAll();
	screenClasses.addSelectionChangedListener(this);

	screenClasses.collapseAll();
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:12,代码来源:ScSourceEditorComposite.java

示例8: createPartControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {
	treeViewer = new TreeViewer(parent);
	treeViewer.setContentProvider(new ViewRefContentProvider());
	treeViewer.setLabelProvider(new ViewRefLabelProvider());
	treeViewer.setInput(null);
	treeViewer.expandAll();

	getSite().setSelectionProvider(treeViewer);
	getSite().getPage().addSelectionListener(this);
	
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:13,代码来源:ReferencesView.java

示例9: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
public void createControl(Composite parent) {
	super.createControl(parent);

	labelProvider = new BashEditorOutlineLabelProvider();

	TreeViewer viewer = getTreeViewer();
	viewer.setContentProvider(contentProvider);
	viewer.addDoubleClickListener(this);
	viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
	viewer.addSelectionChangedListener(this);

	/* it can happen that input is already updated before control created */
	if (input != null) {
		viewer.setInput(input);
	}
	toggleLinkingAction = new ToggleLinkingAction();
	toggleLinkingAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR);
	
	IActionBars actionBars = getSite().getActionBars();
	
	IToolBarManager toolBarManager = actionBars.getToolBarManager();
	toolBarManager.add(toggleLinkingAction);
	
	IMenuManager viewMenuManager = actionBars.getMenuManager();
	viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$

	viewMenuManager.add(new Separator("treeGroup")); //$NON-NLS-1$
	viewMenuManager.add(toggleLinkingAction);
	
	
	/*
	 * when no input is set on init state - let the editor rebuild outline
	 * (async)
	 */
	if (input == null && editor != null) {
		editor.rebuildOutline();
	}

}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:40,代码来源:BashEditorContentOutlinePage.java

示例10: rebuild

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
public void rebuild(BashScriptModel model) {
	if (model == null) {
		return;
	}
	contentProvider.rebuildTree(model);

	TreeViewer treeViewer = getTreeViewer();
	if (treeViewer != null) {
		Control control = treeViewer.getControl();
		if (control == null || control.isDisposed()){
			return;
		}
		treeViewer.setInput(model);
	}
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:16,代码来源:BashEditorContentOutlinePage.java

示例11: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
	super.createControl(parent);
	TreeViewer viewer = getTreeViewer();
	viewer.setContentProvider(new KspContentProvider());
	viewer.setLabelProvider(new KspLabelProvider());
	viewer.addSelectionChangedListener(this);
	viewer.setInput((Object) UiUtils.getEditorFile(editor));

	createActions();
	createToolbar();
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:13,代码来源:KspOutlinePage.java

示例12: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
@Override
public void createControl(final Composite parent) {
  final Composite container = new Composite(parent, SWT.NONE);
  setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider());
  treeViewer.setContentProvider(new CreatingAtomWizardContentProvider());
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
  treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()});

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(final SelectionChangedEvent event) {
      if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
        SelectionPage.this.setPageComplete(true);
      } else {
        SelectionPage.this.setPageComplete(false);
      }
    }
  });

  setPageComplete(false);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:28,代码来源:SelectionPage.java

示例13: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NONE);
  this.setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  TreeViewer treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new MarkerTreeViewLabelProvider());
  treeViewer.setContentProvider(new MarkerTreeViewContentProvider());

  String savedTree = Activator.getDefault().getDialogSettings().get("universe");
  try {
    Object[] array = new Object[1];
    if (savedTree != null) {
      array[0] = Serialization.getInstance().fromString(savedTree);
      treeViewer.setInput(array);
    }
  } catch (IOException | ClassNotFoundException e) {
    e.printStackTrace();
  }

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      String markerType =
          ((MarkerTypeElement) ((TreeSelection) event.getSelection()).getFirstElement())
              .getType();
      if (markerType.equals("universe") || markerType.endsWith("{abs}")) {
        MarkerTypesPage.this.setPageComplete(false);
      } else {
        MarkerTypesPage.this.selection = event.getSelection();
        MarkerTypesPage.this.setPageComplete(true);
      }
    }
  });
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:39,代码来源:MarkerTypesPage.java

示例14: run

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
public void run() {
	TreeViewer v = getTreeViewer();
	boolean checked = isChecked();
	if (checked) {
		v.setSorter(new ViewerSorter());
		v.setInput(v.getInput());
	} else {
		v.setSorter(null);
		redraw();
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:12,代码来源:PropertiesOutlinePage.java

示例15: createPartControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {

	FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
	fillLayout.marginHeight = 5;
	fillLayout.marginWidth = 5;
	parent.setLayout(fillLayout);

	// main container
	container = new Composite(parent, SWT.BORDER);
	container.setLayout(new FillLayout());

	// create container for stack trace data
	Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);

	FormLayout formLayout = new FormLayout();
	formLayout.marginHeight = 5;
	formLayout.marginWidth = 5;
	formLayout.spacing = 5;
	stacktraceDataContainer.setLayout(formLayout);

	Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackLabelContainer.setLayout(new GridLayout());

	FormData stackLabelFormData = new FormData();
	stackLabelFormData.top = new FormAttachment(0);
	stackLabelFormData.left = new FormAttachment(0);
	stackLabelFormData.right = new FormAttachment(100);
	stackLabelFormData.bottom = new FormAttachment(20);
	stackLabelContainer.setLayoutData(stackLabelFormData);

	Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackTraceContainer.setLayout(new FillLayout());

	FormData stackTraceFormData = new FormData();
	stackTraceFormData.top = new FormAttachment(stackLabelContainer);
	stackTraceFormData.left = new FormAttachment(0);
	stackTraceFormData.right = new FormAttachment(100);
	stackTraceFormData.bottom = new FormAttachment(100);
	stackTraceContainer.setLayoutData(stackTraceFormData);

	// Create viewer for test tree in main container
	testTreeViewer = new TreeViewer(container);
	testTreeViewer.setContentProvider(new XpectContentProvider());
	testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
	testTreeViewer.setInput(null);

	// create stack trace label
	stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
	FontData fontData = stacktraceLabel.getFont().getFontData()[0];
	Display display = Display.getCurrent();
	// may be null if outside the UI thread
	if (display == null)
		display = Display.getDefault();
	Font font = new Font(display, new FontData(fontData.getName(), fontData
			.getHeight(), SWT.BOLD));
	// Make stack trace label bold
	stacktraceLabel.setFont(font);

	stacktraceLabel.setText(NO_TRACE_MSG);

	// create stack trace console
	MessageConsole messageConsole = new MessageConsole("trace", null);
	stacktraceConsole = new TraceConsole(messageConsole);
	stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);

	// context menu
	getSite().setSelectionProvider(testTreeViewer);
	MenuManager contextMenu = new MenuManager();
	contextMenu.setRemoveAllWhenShown(true);
	getSite().registerContextMenu(contextMenu, testTreeViewer);
	Control control = testTreeViewer.getControl();
	Menu menu = contextMenu.createContextMenu(control);
	control.setMenu(menu);
	activateContext();

	createSelectionActions();

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:80,代码来源:N4IDEXpectView.java


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