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


Java TreeViewer.addSelectionChangedListener方法代码示例

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


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

示例1: 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

示例2: 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

示例3: createPartControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
/**
	 * This is a callback that will allow us
	 * to create the viewer and initialize it.
	 */
	public void createPartControl(Composite parent) {
		_viewer = new TreeViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
		_contentProvider = new ViewContentProvider();
		_viewer.setContentProvider(_contentProvider);
		ColumnViewerToolTipSupport.enableFor(_viewer);
		_viewer.addSelectionChangedListener(
				new ISelectionChangedListener() {
					public void selectionChanged(SelectionChangedEvent event) {
						fireEngineSelectionChanged();
					}
				});
		
		createColumns();
//		_viewer.setColumnProperties( new String[] {"Status", "Identifier", "Step", "Status"} );
//		_viewer.getTree().setHeaderVisible(true);
		Font mono = JFaceResources.getFont(JFaceResources.TEXT_FONT);
		_viewer.getTree().setFont(mono);
		
		// Create the help context id for the viewer's control
		PlatformUI.getWorkbench().getHelpSystem().setHelp(_viewer.getControl(), "org.eclipse.gemoc.executionframework.ui.views.engine.EngineStatusView");
			
		// register for changes in the RunningEngineRegistry
		//org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addObserver(this);
		
		buildMenu();		

		org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addEngineRegistrationListener(this);
	}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:33,代码来源:EnginesStatusView.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: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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 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();
  }

  for (LoadItem loadItem : TraceManager.get().getLoads()) {
    allEClasses.addAll(loadItem.getAllEClasses().values());
  }

  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}")) {
        TypeSelectionPage.this.setPageComplete(false);
        canFlip = false;
      } else {
        selection = event.getSelection();
        containerSigTypes = TraceManager.get().findContainers(allEClasses, getSelectedType());
        canFlip = !containerSigTypes.isEmpty();
        TypeSelectionPage.this.setPageComplete(true);
        getContainer().updateButtons();
      }
    }
  });

}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:48,代码来源:TypeSelectionPage.java

示例12: createControl

import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
/**
 * (non-Javadoc)
 * 
 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
 */
@Override
public void createControl(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	setControl(composite);
	composite.setLayout(new FillLayout());
	final SashForm mainSashForm = new SashForm(composite, SWT.HORIZONTAL);

	// Master
	final TreeViewer viewer = new TreeViewer(mainSashForm);
	viewer.setContentProvider(new ExamplesContentProvider());
	viewer.setLabelProvider(new ExamplesLabelProvider());
	viewer.setInput(ExamplesRegistry.getInstance().getRegisteredExamples());

	// Details
	Composite details = new Composite(mainSashForm, SWT.NULL);
	final FillLayout detailsLayout = new FillLayout(SWT.VERTICAL);
	detailsLayout.marginWidth = detailsLayout.spacing = 10;
	details.setLayout(detailsLayout);
	final SashForm detailsSashForm = new SashForm(details, SWT.VERTICAL);

	final ImageCanvas screenshotLabel = new ImageCanvas(detailsSashForm, SWT.BORDER);
	final Label descriptionLabel = new Label(detailsSashForm, SWT.NULL);

	// Selection behaviour
	viewer.addSelectionChangedListener(new ISelectionChangedListener() {

		@Override
		public void selectionChanged(SelectionChangedEvent arg0) {
			chosenExample = (IExample) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
			screenshotLabel.setImage(chosenExample.getScreenshot());
			descriptionLabel.setText(chosenExample.getDescription());
			setPageComplete(chosenExample != null && check(chosenExample));
		}
	});

	// Sash weights
	mainSashForm.setWeights(new int[] { 1, 3, });
	detailsSashForm.setWeights(new int[] { 2, 1, });

}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:46,代码来源:ExamplesWizardPage.java


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