List of usage examples for org.eclipse.jface.viewers StructuredSelection getFirstElement
@Override
public Object getFirstElement()
From source file:com.amazonaws.eclipse.dynamodb.testtool.TestToolVersionTable.java
License:Apache License
/** * @return The currently selected test tool version (or null). *//* ww w .j a v a2 s . c om*/ public TestToolVersion getSelection() { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); return (TestToolVersion) selection.getFirstElement(); }
From source file:com.amazonaws.eclipse.ec2.ui.elasticip.ElasticIpComposite.java
License:Apache License
@Override public Address getSelection() { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); return (Address) selection.getFirstElement(); }
From source file:com.amazonaws.eclipse.ec2.ui.elasticip.ElasticIpComposite.java
License:Apache License
@Override protected void makeActions() { newAddressAction = new Action() { public void run() { new RequestElasticIpThread().start(); }// w ww . java 2s. c o m }; newAddressAction.setText("New Elastic IP"); newAddressAction.setToolTipText("Requests a new Elastic IP address"); newAddressAction.setImageDescriptor(Ec2Plugin.getDefault().getImageRegistry().getDescriptor("add")); refreshAddressesAction = new Action() { public void run() { refreshAddressList(); } }; refreshAddressesAction.setText("Refresh"); refreshAddressesAction.setToolTipText("Refresh the Elastic IP address list"); refreshAddressesAction .setImageDescriptor(Ec2Plugin.getDefault().getImageRegistry().getDescriptor("refresh")); releaseAddressAction = new Action() { public void run() { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); Address addressInfo = (Address) selection.getFirstElement(); new ReleaseElasticIpThread(addressInfo).start(); } }; releaseAddressAction.setText("Release"); releaseAddressAction.setToolTipText("Release this Elastic IP"); releaseAddressAction.setImageDescriptor(Ec2Plugin.getDefault().getImageRegistry().getDescriptor("remove")); }
From source file:com.amazonaws.eclipse.ec2.ui.securitygroups.SecurityGroupSelectionComposite.java
License:Apache License
/** * Returns the currently selected security group. * * @return The currently selected security group. *///from w w w . j a v a 2 s .c om public SecurityGroup getSelectedSecurityGroup() { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); return (SecurityGroup) selection.getFirstElement(); }
From source file:com.amazonaws.eclipse.ec2.ui.SelectionTable.java
License:Apache License
/** * Returns the current selection in this table. * * @return The current selection in this table. *///from w w w . j a v a 2s. c o m protected Object getSelection() { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); return selection.getFirstElement(); }
From source file:com.amazonaws.eclipse.ec2.ui.views.instances.InstanceSelectionTable.java
License:Apache License
private Instance getSelectedInstance() { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); return (Instance) selection.getFirstElement(); }
From source file:com.amazonaws.eclipse.elasticbeanstalk.OpenEnvironmentUrlAction.java
License:Open Source License
public void selectionChanged(IAction action, ISelection selection) { StructuredSelection structuredSelection = (StructuredSelection) selection; IServer selectedServer = (IServer) structuredSelection.getFirstElement(); if (selectedServer != null) { Environment environment = (Environment) selectedServer.loadAdapter(Environment.class, null); environmentUrl = environment.getEnvironmentUrl(); }/*from w ww . ja v a2 s . c o m*/ action.setEnabled(selectedServer != null && selectedServer.getServerState() == IServer.STATE_STARTED); }
From source file:com.amazonaws.eclipse.explorer.actions.ConfigurationActionProvider.java
License:Apache License
@Override public void fillContextMenu(IMenuManager menu) { StructuredSelection selection = (StructuredSelection) getActionSite().getStructuredViewer().getSelection(); if (selection.getFirstElement() instanceof ExplorerNode && selection.size() == 1) { ExplorerNode node = (ExplorerNode) selection.getFirstElement(); if (node.getOpenAction() != null) { menu.add(node.getOpenAction()); menu.add(new Separator()); }/*w w w . j a v a 2 s . c o m*/ } }
From source file:com.amazonaws.eclipse.explorer.cloudformation.CloudFormationExplorerActionProvider.java
License:Apache License
@Override public void fillContextMenu(IMenuManager menu) { StructuredSelection selection = (StructuredSelection) getActionSite().getStructuredViewer().getSelection(); if (selection.size() != 1) return;//w w w . j a v a 2 s. c o m menu.add(new CreateStackAction()); Object firstElement = selection.getFirstElement(); if (firstElement instanceof StackNode) { menu.add(new Separator()); menu.add(new SaveStackTemplateAction((StackNode) firstElement)); menu.add(new CancelStackUpdateAction((StackNode) firstElement)); menu.add(new UpdateStackAction((StackNode) firstElement)); } }
From source file:com.amazonaws.eclipse.explorer.identitymanagement.IdentityManagementExplorerActionProvider.java
License:Apache License
@Override public void fillContextMenu(IMenuManager menu) { StructuredSelection selection = (StructuredSelection) getActionSite().getStructuredViewer().getSelection(); if (selection.size() != 1) return;//from w w w. ja v a 2s. c o m if (selection.getFirstElement() instanceof IdentityManagementRootElement || selection.getFirstElement() instanceof UserNode) { menu.add(new CreateUserAction()); } if (selection.getFirstElement() instanceof IdentityManagementRootElement || selection.getFirstElement() instanceof GroupNode) { menu.add(new CreateGroupAction()); } if (selection.getFirstElement() instanceof IdentityManagementRootElement || selection.getFirstElement() instanceof RoleNode) { menu.add(new CreateRoleAction()); } }