本文整理匯總了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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
示例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();
}
}
}
}
示例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();
}
示例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;
}
示例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) {}
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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) {}
}
示例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);
}
}
示例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());
}
}