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


Java IStructuredSelection.getFirstElement方法代码示例

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


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

示例1: execute

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelectionChecked(event);

	IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
	try {
		view = (N4IDEXpectView) windows[0].getActivePage().showView(
				N4IDEXpectView.ID);
	} catch (PartInitException e) {
		N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
	}

	Description desc = (Description) selection.getFirstElement();
	if (desc.isTest() && view.testsExecutionStatus.hasFailed(desc)) {
		Throwable failureException = view.testsExecutionStatus.getFailure(desc).getException();

		if (failureException instanceof ComparisonFailure) {
			ComparisonFailure cf = (ComparisonFailure) failureException;
			// display comparison view
			displayComparisonView(cf, desc);
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:26,代码来源:XpectCompareCommandHandler.java

示例2: activateEditor

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void activateEditor(final IWorkbenchPage page, final IStructuredSelection selection) {
	if (null != selection && !selection.isEmpty()) {
		final Object firstElement = selection.getFirstElement();
		if (firstElement instanceof ResourceNode) {
			final File fileResource = ((ResourceNode) firstElement).getResource();
			if (fileResource.exists() && fileResource.isFile()) {
				final URI uri = URI.createFileURI(fileResource.getAbsolutePath());
				final IResource resource = externalLibraryWorkspace.getResource(uri);
				if (resource instanceof IFile) {
					final IEditorInput editorInput = EditorUtils.createEditorInput(new URIBasedStorage(uri));
					final IEditorPart editor = page.findEditor(editorInput);
					if (null != editor) {
						page.bringToTop(editor);
						return;
					}
				}
			}
		}
	}
	super.activateEditor(page, selection);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:N4JSResourceLinkHelper.java

示例3: dbBlocksJournalViewSelectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
private void dbBlocksJournalViewSelectionChanged(SelectionChangedEvent event) {
    ISelection selection = event.getSelection();
    if (selection.isEmpty()) {
        dbBlocksJournalProcessInfoView.hide();
    } else {
        DBProcess process;
        IStructuredSelection structuredSelection = (IStructuredSelection)selection;
        Object element = structuredSelection.getFirstElement();
        if (element instanceof DBBlocksJournalProcess) {
            DBBlocksJournalProcess blocksJournalProcess = (DBBlocksJournalProcess)element;
            process = blocksJournalProcess.getProcess();
        } else {
            process = (DBProcess)element;
        }
        dbBlocksJournalProcessInfoView.show(process);
    }
}
 
开发者ID:technology16,项目名称:pgsqlblocks,代码行数:18,代码来源:ProcessesController.java

示例4: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
	super.selectionChanged(action, selection);
	IStructuredSelection structuredSelection = (IStructuredSelection) selection;
	TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
	if (treeObject instanceof StepTreeObject) {
		Step step = ((StepTreeObject) treeObject).getObject();
		if (step instanceof AttributeStep || step instanceof XMLAttributeStep) {
			action.setText("Attribute always output true.");
			action.setEnabled(false);
		} else {
			output = !step.isOutput();
			String actionText = output ? "Output true":"Output false";
			actionText += recurse ? " recursively":"";
			action.setText(actionText);
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:18,代码来源:OutputStepAction.java

示例5: openSelectedTreeItemInEditor

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void openSelectedTreeItemInEditor(ISelection selection, boolean grabFocus) {
	if (selection instanceof IStructuredSelection) {
		IStructuredSelection ss = (IStructuredSelection) selection;
		Object firstElement = ss.getFirstElement();
		if (firstElement instanceof Item) {
			Item item = (Item) firstElement;
			int offset = item.getOffset();
			int length = item.getLength();
			if (length == 0) {
				/* fall back */
				length = 1;
			}
			ignoreNextCaretMove = true;
			selectAndReveal(offset, length);
			if (grabFocus) {
				setFocus();
			}
		}
	}
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:21,代码来源:BashEditor.java

示例6: GeneratorChoiceComposite

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public GeneratorChoiceComposite(Composite parent, int style, IStructuredSelection selection, Listener listener) {
	super(parent, style);

	setLayout(new GridLayout(12, false));
	GridData gridData = new GridData();
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	setLayoutData(gridData);

	this.listener = listener;
	this.selection = selection;
	IFile file = (IFile) selection.getFirstElement();
	loadAncestor(file);
	findStartElement () ;
	Label explanationLabel = new Label(this, SWT.NONE);
	explanationLabel.setLayoutData(new GridData(SWT.FILL));
	explanationLabel.setText(MessageUtil.getString("three_modes_explanation"));

	skip(this);

	createAppendMode();
	createExtendMode();
	createNewMode();

}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:26,代码来源:GeneratorChoiceComposite.java

示例7: execute

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
protected Object execute(SchemaRegistryView registryView, AvroSchemaEditor editor, ExecutionEvent event) {
	
	IStructuredSelection selection = (IStructuredSelection) registryView.getSelection();
	
	if (!selection.isEmpty()) {
		Object element = selection.getFirstElement();
		if (element instanceof AvroNode) {
			AvroNode node = (AvroNode) element;
			SchemaViewer masterViewer = editor.getContentPart().getSchemaViewer(AvroContext.Kind.MASTER);
			masterViewer.setSelection(new StructuredSelection(node));
			masterViewer.reveal(node);
		}
	}
	
	return null;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:18,代码来源:ShowInEditorHandler.java

示例8: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
	try {
		boolean enable = true;
		super.selectionChanged(action, selection);
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
		if (treeObject instanceof ObjectsFolderTreeObject) {
			ObjectsFolderTreeObject ofto = (ObjectsFolderTreeObject)treeObject;
			enable = ofto.folderType == ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
			treeObject = ofto.getParent();
		}
		if (enable && treeObject instanceof DatabaseObjectTreeObject) {
			DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
			ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
			enable = actionModel.isEnabled;
		}
		action.setEnabled(enable);
	}
	catch (Exception e) {}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:21,代码来源:CreateVariableAction.java

示例9: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
	super.selectionChanged(action, selection);
	IStructuredSelection structuredSelection = (IStructuredSelection) selection;
	TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
	if (treeObject instanceof DesignDocumentViewTreeObject) {
		DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject)treeObject;
		action.setText(CouchKey.reduce.key() + " function");
		action.setEnabled(!ddvto.hasReduce());
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:11,代码来源:CreateDesignDocumentViewReduceAction.java

示例10: getDetailPaneTypes

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public Set<String> getDetailPaneTypes(IStructuredSelection selection) {
	final Set<String> res = new HashSet<String>();

	final IBreakpoint breakpoint = (IBreakpoint) selection
			.getFirstElement();
	if (breakpoint instanceof DSLBreakpoint) {
		res.add(GemocBreakpointDetailPane.PANEL_TYPE);
	}

	return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:13,代码来源:BreakpointDetailPaneFactory.java

示例11: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
	super.selectionChanged(action, selection);
	IStructuredSelection structuredSelection = (IStructuredSelection) selection;
	TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
	if (treeObject instanceof ConnectorTreeObject) {
		DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
		ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
		action.setChecked(actionModel.isChecked);
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:11,代码来源:SetDefaultConnectorAction.java

示例12: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
	super.selectionChanged(action, selection);
	IStructuredSelection structuredSelection = (IStructuredSelection) selection;
	TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
	if (treeObject instanceof MobilePageComponentTreeObject) {
		DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
		ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
		action.setChecked(actionModel.isChecked);
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:11,代码来源:SetMobileRootPageAction.java

示例13: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
	try {
		boolean enable = false;
		super.selectionChanged(action, selection);
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
		if (treeObject instanceof DatabaseObjectTreeObject) {
			DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
			ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
			enable = actionModel.isEnabled;
		}
		action.setEnabled(enable);
	}
	catch (Exception e) {}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:16,代码来源:ChangeToElementStepAction.java

示例14: run

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
@Override
public void run() {
	super.run();
	IStructuredSelection currentSelectedComponent = (IStructuredSelection) getSelection();
	if (currentSelectedComponent.getFirstElement() instanceof ComponentEditPart) {
		ComponentEditPart componentEditPart = ((ComponentEditPart) currentSelectedComponent.getFirstElement());
		Object componentModel=componentEditPart.getCastedModel();
		ELTPropertyWindow eltPropertyWindow = new ELTPropertyWindow(componentModel);
		eltPropertyWindow.open(); 
		
		componentEditPart.updateComponentView(eltPropertyWindow);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:14,代码来源:ComponentPropertiesAction.java

示例15: selectionChanged

import org.eclipse.jface.viewers.IStructuredSelection; //导入方法依赖的package包/类
public void selectionChanged(IAction action, ISelection selection) {
	super.selectionChanged(action, selection);
	IStructuredSelection structuredSelection = (IStructuredSelection) selection;
	TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
	if (treeObject instanceof DesignDocumentTreeObject) {
		action.setText(((DesignDocumentTreeObject)treeObject).getDefaultViewName());
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:9,代码来源:CreateDesignDocumentViewAction.java


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