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


Java ISelectionProvider類代碼示例

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


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

示例1: setStatusLineMessage

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
/**
 * Tries to set the given message on the workbench's status line. This is a
 * best effort method which fails to set the status line if there is no
 * active editor present from where the statuslinemanager can be looked up.
 * 
 * @param msg
 *            The message to be shown on the status line
 */
public static void setStatusLineMessage(final String msg) {
	IStatusLineManager statusLineManager = null;
	ISelectionProvider selectionService = null;

	// First try to get the StatusLineManager from the IViewPart and only
	// resort back to the editor if a view isn't active right now.
	final IWorkbenchPart workbenchPart = getActiveWindow().getActivePage().getActivePart();
	if (workbenchPart instanceof IViewPart) {
		final IViewPart viewPart = (IViewPart) workbenchPart;
		statusLineManager = viewPart.getViewSite().getActionBars().getStatusLineManager();
		selectionService = viewPart.getViewSite().getSelectionProvider();
	} else if (getActiveEditor() != null) {
		final IEditorSite editorSite = getActiveEditor().getEditorSite();
		statusLineManager = editorSite.getActionBars().getStatusLineManager();
		selectionService = editorSite.getSelectionProvider();
	}

	if (statusLineManager != null && selectionService != null) {
		statusLineManager.setMessage(msg);
		selectionService.addSelectionChangedListener(new StatusLineMessageEraser(statusLineManager,
				selectionService));
	}
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:32,代碼來源:UIHelper.java

示例2: selectionChanged

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的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

示例3: modifyEvent

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的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

示例4: CopyAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public CopyAction(final Display display, final ISelectionProvider selectionProvider) {
  this.display = display;
  this.selectionProvider = selectionProvider;
  setToolTipText("Copy");
  setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
  setDisabledImageDescriptor(PlatformUI
      .getWorkbench()
      .getSharedImages()
      .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
  selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(final SelectionChangedEvent event) {
      setEnabled(!event.getSelection().isEmpty());
    }
  });
  setEnabled(!selectionProvider.getSelection().isEmpty());
}
 
開發者ID:AndreasWBartels,項目名稱:libraries,代碼行數:19,代碼來源:CopyAction.java

示例5: insertMultiLiner

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
private void insertMultiLiner(BracketInsertion data, ISelectionProvider selectionProvider, int offset,
		IDocument document) throws BadLocationException {
	IRegion region = document.getLineInformationOfOffset(offset);
	if (region == null) {
		return;
	}
	int length = region.getLength();

	String textBeforeColumn = document.get(offset - length, length-1); //-1 to get not he bracket itself
	String relevantColumnsBefore = TextUtil.trimRightWhitespaces(textBeforeColumn);
	InsertionData result = support.prepareInsertionString(
			data.createMultiLineTemplate(SourceCodeInsertionSupport.CURSOR_VARIABLE), relevantColumnsBefore);

	document.replace(offset - 1, 1, result.getSourceCode());
	selectionProvider.setSelection(new TextSelection(offset + result.getCursorOffset() - 1, 0));

}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:18,代碼來源:GroovyBracketInsertionCompleter.java

示例6: registerSubControlContextMenus

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
private void registerSubControlContextMenus() {
    final AbstractCheckinSubControl[] subControls = checkinControl.getSubControls();

    for (int i = 0; i < subControls.length; i++) {
        final MenuManager contextMenu = subControls[i].getContextMenu();
        final ISelectionProvider selectionProvider = subControls[i].getSelectionProvider();

        if (contextMenu != null && selectionProvider != null) {
            addAdditionsGroupToContextMenu(contextMenu);
            getViewSite().registerContextMenu(
                getViewSite().getId() + "." + subControls[i].getSubControlType().getID(), //$NON-NLS-1$
                contextMenu,
                selectionProvider);
        }
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:17,代碼來源:AbstractCheckinControlView.java

示例7: registerContextMenu

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public void registerContextMenu(
    final TeamExplorerContext context,
    final Control control,
    final ISelectionProvider provider) {
    final MenuManager contextMenuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
    contextMenuManager.setRemoveAllWhenShown(false);
    contextMenuManager.add(new Separator("group1")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group2")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group3")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group4")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group5")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group6")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group7")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group8")); //$NON-NLS-1$
    contextMenuManager.add(new Separator("group9")); //$NON-NLS-1$
    contextMenuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));

    final Menu menu = contextMenuManager.createContextMenu(control);
    control.setMenu(menu);

    context.getWorkbenchPart().getSite().registerContextMenu(EXTENSION_POINT_ID, contextMenuManager, provider);
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:23,代碼來源:TeamExplorerBaseSection.java

示例8: CompareChangeWithLatestVersionAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public CompareChangeWithLatestVersionAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final CompareUIType compareUIType,
    final Shell shell) {
    super(selectionProvider, repository);

    Check.notNull(compareUIType, "compareUIType"); //$NON-NLS-1$
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    this.compareUIType = compareUIType;
    this.shell = shell;

    setText(Messages.getString("CompareChangeWithLatestVersionAction.ActionText")); //$NON-NLS-1$
    setToolTipText(Messages.getString("CompareChangeWithLatestVersionAction.ActionTooltip")); //$NON-NLS-1$
    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_COMPARE));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:18,代碼來源:CompareChangeWithLatestVersionAction.java

示例9: CompareShelvedChangeWithUnmodifiedVersionAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public CompareShelvedChangeWithUnmodifiedVersionAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final CompareUIType compareUIType,
    final String shelvesetName,
    final String shelvesetOwner,
    final Shell shell) {
    super(selectionProvider, repository);

    Check.notNull(compareUIType, "compareUIType"); //$NON-NLS-1$
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    this.compareUIType = compareUIType;
    this.shell = shell;

    setShelvesetInfo(shelvesetName, shelvesetOwner);

    setText(Messages.getString("CompareShelvedChangeWithUnmodifiedVersionAction.ActionText")); //$NON-NLS-1$
    setToolTipText(Messages.getString("CompareShelvedChangeWithUnmodifiedVersionAction.ActionTooltip")); //$NON-NLS-1$
    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_COMPARE));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:22,代碼來源:CompareShelvedChangeWithUnmodifiedVersionAction.java

示例10: CompareChangeWithWorkspaceVersionAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public CompareChangeWithWorkspaceVersionAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final CompareUIType compareUIType,
    final Shell shell) {
    super(selectionProvider, repository);

    Check.notNull(compareUIType, "compareUIType"); //$NON-NLS-1$
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    this.compareUIType = compareUIType;
    this.shell = shell;

    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_COMPARE));

    if (repository != null) {
        setRepository(repository);
    } else {
        setText(Messages.getString("CompareChangeWithWorkspaceVersionAction.ActionText")); //$NON-NLS-1$
        setToolTipText(Messages.getString("CompareChangeWithWorkspaceVersionAction.ActionTooltip")); //$NON-NLS-1$
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:23,代碼來源:CompareChangeWithWorkspaceVersionAction.java

示例11: ComparePendingChangeWithWorkspaceVersionAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public ComparePendingChangeWithWorkspaceVersionAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final CompareUIType compareUIType,
    final Shell shell) {
    super(selectionProvider, repository);

    Check.notNull(compareUIType, "compareUIType"); //$NON-NLS-1$
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    this.compareUIType = compareUIType;
    this.shell = shell;

    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_COMPARE));

    if (repository != null) {
        setRepository(repository);
    } else {
        setText(Messages.getString("ComparePendingChangeWithWorkspaceVersionAction.ActionText")); //$NON-NLS-1$
        setToolTipText(Messages.getString("ComparePendingChangeWithWorkspaceVersionAction.ActionTooltip")); //$NON-NLS-1$
    }
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:23,代碼來源:ComparePendingChangeWithWorkspaceVersionAction.java

示例12: ViewPendingChangeAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public ViewPendingChangeAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final boolean inModalContext,
    final ViewVersionType viewVersionType) {
    super(selectionProvider, repository);

    Check.notNull(viewVersionType, "viewVersionType"); //$NON-NLS-1$

    this.inModalContext = inModalContext;
    this.viewVersionType = viewVersionType;

    setText(viewVersionType.getText());
    setToolTipText(viewVersionType.getTooltipText());
    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_VIEW));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:17,代碼來源:ViewPendingChangeAction.java

示例13: CompareShelvedChangeWithLatestVersionAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public CompareShelvedChangeWithLatestVersionAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final CompareUIType compareUIType,
    final String shelvesetName,
    final String shelvesetOwner,
    final Shell shell) {
    super(selectionProvider, repository);

    Check.notNull(compareUIType, "compareUIType"); //$NON-NLS-1$
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    this.compareUIType = compareUIType;
    this.shell = shell;

    setShelvesetInfo(shelvesetName, shelvesetOwner);

    final String text = Messages.getString("CompareShelvedChangeWithLatestVersionAction.ActionText"); //$NON-NLS-1$
    setText(text);
    setToolTipText(text);
    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_COMPARE));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:23,代碼來源:CompareShelvedChangeWithLatestVersionAction.java

示例14: CompareChangeWithPreviousVersionAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public CompareChangeWithPreviousVersionAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final CompareUIType compareUIType,
    final Shell shell) {
    super(selectionProvider, repository);

    Check.notNull(compareUIType, "compareUIType"); //$NON-NLS-1$
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    this.compareUIType = compareUIType;
    this.shell = shell;

    setText(Messages.getString("CompareChangeWithPreviousVersionAction.ActionText")); //$NON-NLS-1$
    setToolTipText(Messages.getString("CompareChangeWithPreviousVersionAction.ActionTooltip")); //$NON-NLS-1$
    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_COMPARE));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:18,代碼來源:CompareChangeWithPreviousVersionAction.java

示例15: ComparePendingChangeWithLatestVersionAction

import org.eclipse.jface.viewers.ISelectionProvider; //導入依賴的package包/類
public ComparePendingChangeWithLatestVersionAction(
    final ISelectionProvider selectionProvider,
    final TFSRepository repository,
    final CompareUIType compareUIType,
    final Shell shell) {
    super(selectionProvider, repository);

    Check.notNull(compareUIType, "compareUIType"); //$NON-NLS-1$
    Check.notNull(shell, "shell"); //$NON-NLS-1$

    this.compareUIType = compareUIType;
    this.shell = shell;

    final String text = Messages.getString("ComparePendingChangeWithLatestVersionAction.ActionText"); //$NON-NLS-1$
    setText(text);
    setToolTipText(text);
    setImageDescriptor(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_COMPARE));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:19,代碼來源:ComparePendingChangeWithLatestVersionAction.java


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