當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。