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


Java SelectionChangedEvent类代码示例

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


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

示例1: setActiveEditor

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
/**
 * When the active editor changes, this remembers the change and registers with it as a selection provider.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setActiveEditor(IEditorPart part) {
	super.setActiveEditor(part);
	activeEditorPart = part;

	// Switch to the new selection provider.
	//
	if (selectionProvider != null) {
		selectionProvider.removeSelectionChangedListener(this);
	}
	if (part == null) {
		selectionProvider = null;
	}
	else {
		selectionProvider = part.getSite().getSelectionProvider();
		selectionProvider.addSelectionChangedListener(this);

		// Fake a selection changed event to update the menus.
		//
		if (selectionProvider.getSelection() != null) {
			selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
		}
	}
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:31,代码来源:Time4sysActionBarContributor.java

示例2: setActiveEditor

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
/**
 * When the active editor changes, this remembers the change and registers with it as a selection provider.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   @Override
   public void setActiveEditor(IEditorPart part) {
	super.setActiveEditor(part);
	activeEditorPart = part;

	// Switch to the new selection provider.
	//
	if (selectionProvider != null) {
		selectionProvider.removeSelectionChangedListener(this);
	}
	if (part == null) {
		selectionProvider = null;
	}
	else {
		selectionProvider = part.getSite().getSelectionProvider();
		selectionProvider.addSelectionChangedListener(this);

		// Fake a selection changed event to update the menus.
		//
		if (selectionProvider.getSelection() != null) {
			selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
		}
	}
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:31,代码来源:SmarthomeActionBarContributor.java

示例3: handleSelectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
protected void handleSelectionChanged ( final SelectionChangedEvent event )
{
    if ( this.handlingEvent )
    {
        return;
    }

    final TreeNode node = (TreeNode) ( (IStructuredSelection)event.getSelection () ).getFirstElement ();
    final TreeNode nodeShown = this.manager.showPage ( node );

    try
    {
        this.handlingEvent = true;
        // select the node, could also be the old one
        this.viewer.setSelection ( new StructuredSelection ( nodeShown ), true );
    }
    finally
    {
        this.handlingEvent = false;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:MainEntryPoint.java

示例4: selectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
@Override
public void selectionChanged(SelectionChangedEvent event) {
    super.selectionChanged(event);

    ISelection selection = event.getSelection();
    if (selection.isEmpty()) {
        sqlEditor.resetHighlightRange();
    } else {
        Segments segment = (Segments) ((IStructuredSelection) selection)
                .getFirstElement();
        int start = segment.getOffset();
        int length = segment.getLength();
        try {
            sqlEditor.setHighlightRange(start, length, true);
            sqlEditor.selectAndReveal(start, length);
        } catch (IllegalArgumentException x) {
            sqlEditor.resetHighlightRange();
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:21,代码来源:SQLEditorContentOutlinePage.java

示例5: selectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
@Override
public void selectionChanged(SelectionChangedEvent event) {
	IStructuredSelection selection = (IStructuredSelection) event.getSelection();
	Object selected = selection.getFirstElement();
	if (selected instanceof TemplateProvider) {
		provider = (TemplateProvider) selected;
	}
	if (selected instanceof Folder) {
		targetFolder = (Folder)selected;
	} 
	if (selected instanceof InitialBuildPolicies) {
		policies 	= ((InitialBuildPolicies) selected);
	}		
	if (selected instanceof String) {
		filename 	= ((String) selected);
	}
	fExtraPage.validatePage();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:19,代码来源:GW4ECreationWizard.java

示例6: selectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
public void selectionChanged(SelectionChangedEvent event) {
	if (event.getSource() instanceof ISelectionProvider) {
		IStructuredSelection selection = (IStructuredSelection) event.getSelection();
		TreeObject treeObject = (TreeObject) selection.getFirstElement();
		if (treeObject != null) {
			ConnectorTreeObject connectorTreeObject = treeObject.getConnectorTreeObject();
			if (connectorTreeObject != null) {
				Connector connector =  (Connector)connectorTreeObject.getObject();
				if (connector.equals(htmlConnector)) {
					if (treeObject instanceof TransactionTreeObject) {
						if (!htmlConnector.isLearning())
							toolLearn.setEnabled(true);
					}
					else {
						if (!htmlConnector.isLearning())
							toolLearn.setEnabled(false);
					}
				}
				else {
					if (!htmlConnector.isLearning())
						toolLearn.setEnabled(false);
				}
			}
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:27,代码来源:HtmlConnectorDesignComposite.java

示例7: selectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
@Override
public void selectionChanged(SelectionChangedEvent event) {
	IStructuredSelection selection = (IStructuredSelection) event.getSelection();
	Object selected = selection.getFirstElement();
	if (selected instanceof TemplateProvider) {
		provider = (TemplateProvider) selected;
	}
	if (selected instanceof IFolder) {
		targetFolder 	= ((IFolder) selected);
		project  		= targetFolder.getProject();
	}
	if (selected instanceof InitialBuildPolicies) {
		policies 	= ((InitialBuildPolicies) selected);
	}
	if (selected instanceof String) {
		filename 	= ((String) selected);
	}		
	fExtraPage.validatePage();
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:20,代码来源:GW4EModelWizard.java

示例8: modifyEvent

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
/**
 * Ensures that IProject is present as first element
 * and DBPair is present as second element of the selection.
 */
private SelectionChangedEvent modifyEvent(SelectionChangedEvent event, DBPair dbPair) {
    ISelection selection = event.getSelection();
    if (selection.isEmpty()) {
        return defaultSelectionEvent;
    }
    if (!(selection instanceof IStructuredSelection)) {
        Log.log(Log.LOG_WARNING, "Cannot handle this selection type: " + selection.toString()); //$NON-NLS-1$
        // no way to deal with empty/other types of selections
        return defaultSelectionEvent;
    }

    IStructuredSelection sel = (IStructuredSelection) selection;
    List<?> elements = sel.toList();

    List<Object> newElements = new ArrayList<>(elements.size() + 2);
    newElements.add(proj);
    newElements.add(dbPair);
    newElements.addAll(elements);

    return new SelectionChangedEvent((ISelectionProvider) event.getSource(),
            new StructuredSelection(newElements));
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:27,代码来源:ProjectEditorSelectionProvider.java

示例9: fireSelection

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
/**
 * Call to programmatically fire a selection. This should be called directly from outside
 * this class to set the workbench selection when the elements in the selection are not
 * in the wrapped selection provider (e.g. a {@link TableViewer}).
 * @param selection selection to fire
 */
public void fireSelection(ISelection selection) {
	if (listeners.isEmpty()) return;
	SelectionChangedEvent e = new SelectionChangedEvent(this, selection);
	ISelectionChangedListener[] sl = listeners.toArray(new ISelectionChangedListener[listeners.size()]);
	for (ISelectionChangedListener s : sl) s.selectionChanged(e);
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:13,代码来源:DelegatingSelectionProvider.java

示例10: selectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
 * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
 * that can be added to the selected object and updating the menus accordingly.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void selectionChanged(SelectionChangedEvent event) {
	// Remove any menu items for old selection.
	//
	if (createChildMenuManager != null) {
		depopulateManager(createChildMenuManager, createChildActions);
	}
	if (createSiblingMenuManager != null) {
		depopulateManager(createSiblingMenuManager, createSiblingActions);
	}

	// Query the new selection for appropriate new child/sibling descriptors
	//
	Collection<?> newChildDescriptors = null;
	Collection<?> newSiblingDescriptors = null;

	ISelection selection = event.getSelection();
	if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
		Object object = ((IStructuredSelection)selection).getFirstElement();

		EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();

		newChildDescriptors = domain.getNewChildDescriptors(object, null);
		newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
	}

	// Generate actions for selection; populate and redraw the menus.
	//
	createChildActions = generateCreateChildActions(newChildDescriptors, selection);
	createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);

	if (createChildMenuManager != null) {
		populateManager(createChildMenuManager, createChildActions, null);
		createChildMenuManager.update(true);
	}
	if (createSiblingMenuManager != null) {
		populateManager(createSiblingMenuManager, createSiblingActions, null);
		createSiblingMenuManager.update(true);
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:48,代码来源:FsmActionBarContributor.java

示例11: onSelectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
protected void onSelectionChanged(@SuppressWarnings("unused") SelectionChangedEvent event) {
	final ListEntry selEntry = getSingleSelectedEntry();
	if (selEntry != null) {
		canvas.setGraph(selEntry.graph);
	} else {
		canvas.clear();
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:GraphList.java

示例12: setSelection

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
@Override
public void setSelection(ISelection selection) {
	currentEditorSelection = selection;
	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:8,代码来源:GW4EEditor.java

示例13: initialize

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
public void initialize(String widgetid, boolean active) {
	setEnabled(active);
	setContentProvider(new IStructuredContentProvider() {
		@Override
		public Object[] getElements(Object inputElement) {
			List<IFile> files = (List<IFile>) inputElement;
			Object[] ret = new Object[files.size()];
			int index = 0;
			for (IFile file : files) {
				ret[index++] = JavaCore.create(file);
			}
			return ret;
		}
	});
	setLabelProvider(new JavaElementLabelProvider(
			JavaElementLabelProvider.SHOW_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT));
	addSelectionChangedListener(new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection selection = (IStructuredSelection) event.getSelection();
			if (selection.size() > 0) {
				ICompilationUnit element = (ICompilationUnit) selection.getFirstElement();
				GeneratorChoiceComposite.this.pkgf = (IPackageFragment) element.getParent();
				listener.handleEvent(null);
			}
		}
	});
	setData(GW4E_CONVERSION_WIDGET_ID, widgetid);

	setInput(ancestors);
	if (active && hasItems()) {
		setSelection(new StructuredSelection(JavaCore.create(ancestors.get(0))));
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:35,代码来源:GeneratorChoiceComposite.java

示例14: selectionChanged

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
 * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
 * that can be added to the selected object and updating the menus accordingly.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   public void selectionChanged(SelectionChangedEvent event) {
	// Remove any menu items for old selection.
	//
	if (createChildMenuManager != null) {
		depopulateManager(createChildMenuManager, createChildActions);
	}
	if (createSiblingMenuManager != null) {
		depopulateManager(createSiblingMenuManager, createSiblingActions);
	}

	// Query the new selection for appropriate new child/sibling descriptors
	//
	Collection<?> newChildDescriptors = null;
	Collection<?> newSiblingDescriptors = null;

	ISelection selection = event.getSelection();
	if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
		Object object = ((IStructuredSelection)selection).getFirstElement();

		EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();

		newChildDescriptors = domain.getNewChildDescriptors(object, null);
		newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
	}

	// Generate actions for selection; populate and redraw the menus.
	//
	createChildActions = generateCreateChildActions(newChildDescriptors, selection);
	createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);

	if (createChildMenuManager != null) {
		populateManager(createChildMenuManager, createChildActions, null);
		createChildMenuManager.update(true);
	}
	if (createSiblingMenuManager != null) {
		populateManager(createSiblingMenuManager, createSiblingActions, null);
		createSiblingMenuManager.update(true);
	}
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:48,代码来源:SmarthomeActionBarContributor.java

示例15: setSelection

import org.eclipse.jface.viewers.SelectionChangedEvent; //导入依赖的package包/类
/**
 * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
 * Calling this result will notify the listeners.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   public void setSelection(ISelection selection) {
	editorSelection = selection;

	for (ISelectionChangedListener listener : selectionChangedListeners) {
		listener.selectionChanged(new SelectionChangedEvent(this, selection));
	}
	setStatusLineManager(selection);
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:16,代码来源:SmarthomeEditor.java


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