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


Java ListViewer.addSelectionChangedListener方法代碼示例

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


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

示例1: createMapSection

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
private void createMapSection() {
	Section mapSection = toolkit.createSection(form.getBody(),
			ExpandableComposite.TWISTIE | Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
	mapSection.setText("Skirmish Maps");

	mapSection.setExpanded(true);
	mapSection.setDescription("A list of available skirmish maps.");

	Composite mapComposite = toolkit.createComposite(mapSection);
	GridLayout squadGridLayout = new GridLayout();
	squadGridLayout.numColumns = 3;

	mapComposite.setLayout(squadGridLayout);

	listViewer = new ListViewer(mapComposite, SWT.WRAP | SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
	listViewer.add(SkirmishMapsLookup.getInstance().getMaps().toArray());
	listViewer.addSelectionChangedListener(new LoadMapImageSelectionListener());

	GridData mapSize = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 5);
	mapSize.minimumHeight = 300;
	mapSize.heightHint = 300;
	
	listViewer.getList().setLayoutData(mapSize);
	mapSection.setClient(mapComposite);
}
 
開發者ID:NineWorlds,項目名稱:xstreamer,代碼行數:26,代碼來源:MapsFormPage.java

示例2: createDialogArea

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	
	GridLayout gridLayout = (GridLayout) container.getLayout();
	gridLayout.numColumns = 1;
	
	container.setLayout(gridLayout);
	
	Composite message = new Composite(container, SWT.NONE);
	message.setLayout(new FillLayout());
	message.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	createMessageArea(message);
	
	listViewer = new ListViewer(container);
	listViewer.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	
	listViewer.setLabelProvider(labelProvider);
	listViewer.setContentProvider(new ArrayContentProvider());
	
	listViewer.setInput(content);
	
	listViewer.setSelection(new StructuredSelection(getInitialElementSelections()));
	listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection selection = (IStructuredSelection)listViewer.getSelection();
			setResult(selection.toList());
		}
	});
	return container;
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:34,代碼來源:ListSelectionDialog.java

示例3: construct

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
public Control construct(Composite parent) {
	Composite container = new Composite(parent, SWT.FILL);
	container.setLayout(new GridLayout());
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	listViewer = new ListViewer(container);
	listViewer.setContentProvider(new ObjectsContentProvider());
	listViewer.setLabelProvider(new ObjectsLabelProvider());
	listViewer.setInput(new ObjectsList());

	listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		/*
		 * Mockup to test events on SWT List control
		 */@Override
		public void selectionChanged(SelectionChangedEvent event) {
			String outString = "Select" + "\n";
			txt.append(outString);
		}
	});

	txt = new Text(container, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
	txt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	txt.setFocus();
	txt.setText("");

	return null;
}
 
開發者ID:xored,項目名稱:q7.quality.mockups,代碼行數:29,代碼來源:ListViewerEventsMockup.java

示例4: initLibraryOptionsUI

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
private Composite initLibraryOptionsUI(DataBindingContext dbc, Composite parent) {
	// Additional library project options
	final Group libraryProjectOptionsGroup = new Group(parent, NONE);
	libraryProjectOptionsGroup
			.setLayout(GridLayoutFactory.fillDefaults().margins(12, 5).numColumns(2).equalWidth(false).create());

	emptyPlaceholder(libraryProjectOptionsGroup);

	final Button createGreeterFileButton = new Button(libraryProjectOptionsGroup, CHECK);
	createGreeterFileButton.setText("Create a greeter file");
	createGreeterFileButton.setLayoutData(GridDataFactory.fillDefaults().create());

	new Label(libraryProjectOptionsGroup, SWT.NONE).setText("Implementation ID:");
	final Text implementationIdText = new Text(libraryProjectOptionsGroup, BORDER);
	implementationIdText.setLayoutData(fillDefaults().align(FILL, SWT.CENTER).grab(true, false).create());

	final Label implementedProjectsLabel = new Label(libraryProjectOptionsGroup, SWT.NONE);
	implementedProjectsLabel.setText("Implemented projects:");
	implementedProjectsLabel
			.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.LEFT, SWT.TOP).create());

	final ListViewer apiViewer = new ListViewer(libraryProjectOptionsGroup, BORDER | MULTI);
	apiViewer.getControl().setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).span(1, 1).create());
	apiViewer.setContentProvider(ArrayContentProvider.getInstance());
	apiViewer.setInput(getAvailableApiProjectIds());

	initApiViewerBinding(dbc, apiViewer);
	initImplementationIdBinding(dbc, implementationIdText);
	initDefaultCreateGreeterBindings(dbc, createGreeterFileButton);

	// Invalidate on change
	apiViewer.addSelectionChangedListener(e -> {
		setPageComplete(validatePage());
	});
	// Invalidate on change
	implementationIdText.addModifyListener(e -> {
		setPageComplete(validatePage());
	});

	return libraryProjectOptionsGroup;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:42,代碼來源:N4MFWizardNewProjectCreationPage.java

示例5: showAnnotations

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
/**
 * Show the annotation view.
 * @param svnFile
 * @param svnAnnotateBlocks
 * @param contents
 * @param useHistoryView
 * @throws PartInitException
 */
public void showAnnotations(ISVNRemoteFile svnFile, Collection svnAnnotateBlocks, InputStream contents, boolean useHistoryView) throws PartInitException {

	// Disconnect from old annotation editor
	disconnect();
	
	// Remove old viewer
	Control[] oldChildren = top.getChildren();
	if (oldChildren != null) {
		for (int i = 0; i < oldChildren.length; i++) {
			oldChildren[i].dispose();
		}
	}

	viewer = new ListViewer(top, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer.setContentProvider(new ArrayContentProvider());
	viewer.setLabelProvider(new LabelProvider());
	viewer.addSelectionChangedListener(this);
	viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));

	PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), IHelpContextIds.ANNOTATIONS_VIEW);

	top.layout();
	
	this.svnFile = svnFile;
	this.contents = contents;
	this.svnAnnotateBlocks = svnAnnotateBlocks;
	page = SVNUIPlugin.getActivePage();
	viewer.setInput(svnAnnotateBlocks);
	editor = (ITextEditor) openEditor();
	IDocumentProvider provider = editor.getDocumentProvider();
	document = provider.getDocument(editor.getEditorInput());

	setPartName(Policy.bind("SVNAnnotateView.showFileAnnotation", new Object[] {svnFile.getName()})); //$NON-NLS-1$
	setTitleToolTip(svnFile.getName());
	
	if (!useHistoryView) {
		return;
	}

	// Get hook to the HistoryView
	historyView = (IHistoryView)page.showView(ISVNUIConstants.HISTORY_VIEW_ID);
	if (historyView != null) {
		historyView.showHistoryFor(svnFile);
	}
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:54,代碼來源:AnnotateView.java

示例6: createDialogArea

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite contents = new Composite(parent, SWT.NONE);
	contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	contents.setLayout(new GridLayout());
	Label lbl1 = new Label(contents, SWT.NONE);
	lbl1.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
	lbl1.setText("Selected Project:");
	Label lblSelectedProj = new Label(contents, SWT.BORDER);
	lblSelectedProj.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
	lblSelectedProj.setText(selectedProjectSpace.getProjectName());

	Label lbl3 = new Label(contents, SWT.NONE);
	lbl3.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
	lbl3.setText("Compare to:");

	listViewer = new ListViewer(contents, SWT.SINGLE);
	listViewer.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	listViewer.setContentProvider(new IStructuredContentProvider() {
		public Object[] getElements(Object inputElement) {
			List<? extends ESProject> projects = ESWorkspaceProviderImpl.getInstance().getWorkspace()
				.getLocalProjects();
			return projects.toArray();
		}

		public void dispose() {
		}

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

	listViewer.setLabelProvider(new LabelProvider() {

		@Override
		public String getText(Object element) {
			// TODO Auto-generated method stub
			return ((ProjectSpace) element).getProjectName();
		}

	});
	listViewer.addSelectionChangedListener(new ISelectionChangedListener() {

		public void selectionChanged(SelectionChangedEvent event) {
			ProjectSpace secondProjectSpace = (ProjectSpace) (((StructuredSelection) event.getSelection())
				.getFirstElement());
			if (secondProjectSpace.equals(selectedProjectSpace)) {
				CompareProjectsDialog.this.setErrorMessage("Selected projects must be different");
				CompareProjectsDialog.this.getButton(CompareProjectsDialog.OK).setEnabled(false);
			} else {
				CompareProjectsDialog.this.setErrorMessage(null);
				CompareProjectsDialog.this.getButton(CompareProjectsDialog.OK).setEnabled(true);
			}
		}
	});
	listViewer.setInput(new Object());

	this.setTitle("Select a project from list to compare");
	return contents;
}
 
開發者ID:edgarmueller,項目名稱:emfstore-rest,代碼行數:66,代碼來源:CompareProjectsDialog.java

示例7: createControl

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent)
{

	Composite container = new Composite(parent, SWT.NONE);
	container.setLayout(new FillLayout());
	
	ListViewer listViewer = new ListViewer(container);
	listViewer.setContentProvider(new ArrayContentProvider());		
	listViewer.setLabelProvider(new WorkbenchLabelProvider());
	
	listViewer.setInput(ExplorerProjectPaths.getCloudScaleProjects());
	
	listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			
			if(event.getSelection() instanceof StructuredSelection){
				StructuredSelection ss = (StructuredSelection)event.getSelection();
				
				if(ss != null){
					
					Object selection = ss.getFirstElement();
					
					if(selection instanceof IProject){
						
						if(handleSelection((IProject)selection)){
							project = (IProject)selection;
							setPageComplete(true);
							return;
						}						
					}
				}
				
				setPageComplete(false);
			}
		}
	});

	setPageComplete(false);
	setControl(container);
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:44,代碼來源:ProjectSelectionPage.java

示例8: createControl

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
	
	Composite container = new Composite(parent, SWT.NONE);
	
	setPageComplete(false);
	setControl(container);
	container.setLayout(new FillLayout(SWT.HORIZONTAL));
	
	listContentProvider = new ObservableListContentProvider();
	IObservableMap observeMap = Properties.observeEach(listContentProvider.getKnownElements(), PojoProperties.values(new String[] { "name" }))[0];
	listLabelProvider = new ObservableMapLabelProvider(observeMap);
	
	listViewer = new ListViewer(container, SWT.BORDER | SWT.V_SCROLL);
	listViewer.setContentProvider(listContentProvider);
	listViewer.setLabelProvider(listLabelProvider);
	listViewer.addSelectionChangedListener(new ISelectionChangedListener()
	{
		@Override
		public void selectionChanged(SelectionChangedEvent event)
		{
			
			Object selection = ((StructuredSelection)listViewer.getSelection()).getFirstElement();
			if(selection instanceof IEditorInputResource){
				selectedAlternative = (IEditorInputResource)selection;
				if(handleSelection((IEditorInputResource)selection)){
					selectedAlternative = (IEditorInputResource)selection;
				}
				else{
					selectedAlternative = null;
				}
			}
			else{
				selectedAlternative = null;
			}
			
			checkComplete();

		}
	});

	setResourceProvider(resourceProvider);
	
	//auto-select first element
	Object e = listViewer.getElementAt(0);
	if (e != null){
		listViewer.setSelection(new StructuredSelection(e));
	}

}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:51,代碼來源:AlternativeSelectionPage.java

示例9: createPartControl

import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
/**
 * This is a callback that will allow us to create the viewer and initialize
 * it.
 */
public void createPartControl(Composite parent) {
	IWorkbench wb = PlatformUI.getWorkbench();
	IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
       IWorkbenchPage page = win.getActivePage();
	
	leakSourcesVw = (LeakSourcesVw) page.findView(LeakSourcesVw.ID);
	
	/*
	mParser = new SuspectSearch();

	XmlManager xmlManager = new XmlManager();
	xmlManager.readApiDescriptor("suspicious_api_in.xml");
	List<ApiDescriptor> parsedApi = xmlManager.getParsedApi();
	System.out.println(">>parsed API:\n\n");
	for (ApiDescriptor desc : parsedApi) {
		System.out.println(desc.toString());
	}

	mParser.setSuspectApi(parsedApi);
	mParser.run();

	viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
			| SWT.V_SCROLL);
	viewer.setContentProvider(new ArrayContentProvider());
	viewer.setLabelProvider(new ViewLabelProvider());
	getSite().setSelectionProvider(viewer);
	viewer.setInput(getElements());
	*/
	mSinksListVw = new ListViewer(parent);
	
	mSinksListVw.setContentProvider(new ArrayContentProvider());
	
	// viewer.setLabelProvider(new ViewLabelProvider());
	// getSite().setSelectionProvider(mSinksListVw);

	mSinksListVw
			.addSelectionChangedListener(new ISelectionChangedListener() {

				@Override
				public void selectionChanged(SelectionChangedEvent event) {
					IStructuredSelection selection = (IStructuredSelection) mSinksListVw
							.getSelection();
					ApiDescriptor firstElement = (ApiDescriptor) selection
							.getFirstElement();
					if (mApiDescSelectioin != null) {
						mApiDescSelectioin.onApiDescriptorSelected(firstElement);
					}
					if (firstElement != null) {
						leakSourcesVw.setSources(firstElement.getDependencyList());
						leakSourcesVw.showSources();
					}
				}
			});
	
	
}
 
開發者ID:SeoulTech,項目名稱:Manal,代碼行數:61,代碼來源:SuspectListVw.java


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