List of usage examples for org.eclipse.jface.viewers IStructuredSelection toArray
public Object[] toArray();
From source file:com.astra.ses.spell.database.browser.views.telecommand.TelecommandViewPart.java
License:Open Source License
/************************************************************************** * Get selected commands//from w ww. ja va 2s. co m * @return *************************************************************************/ public Command[] getSelectedCommands() { // Retrieve selected elements from this viewer IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection(); Object[] elements = selection.toArray(); Command[] commands = new Command[elements.length]; for (int i = 0; i < elements.length; i++) { commands[i] = (Command) elements[i]; } return commands; }
From source file:com.astra.ses.spell.database.browser.views.TelecommandPage.java
License:Open Source License
List<ITelecommand> getSelectedCommands() { // Retrieve selected elements from this viewer IStructuredSelection selection = (IStructuredSelection) getViewerSelectedElements(); Object[] elements = selection.toArray(); List<ITelecommand> commands = new ArrayList<ITelecommand>(); for (int i = 0; i < elements.length; i++) { commands.add((ITelecommand) elements[i]); }/*from w ww.ja v a2s . c om*/ return commands; }
From source file:com.astra.ses.spell.database.browser.views.telemetry.TelemetryViewPart.java
License:Open Source License
/*************************************************************************** * Get selected elements/*from w w w . ja va2 s .c o m*/ * @return **************************************************************************/ public TelemetryParameter[] getSelectedParameters() { // Retrieve selected elements from this viewer IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection(); Object[] elements = selection.toArray(); TelemetryParameter[] params = new TelemetryParameter[elements.length]; for (int i = 0; i < elements.length; i++) { params[i] = (TelemetryParameter) elements[i]; } return params; }
From source file:com.astra.ses.spell.database.browser.views.TelemetryPage.java
License:Open Source License
List<ITelemetryParameter> getSelectedParameters() { // Retrieve selected elements from this viewer IStructuredSelection selection = (IStructuredSelection) getViewerSelectedElements(); Object[] elements = selection.toArray(); List<ITelemetryParameter> params = new ArrayList<ITelemetryParameter>(); for (int i = 0; i < elements.length; i++) { params.add((ITelemetryParameter) elements[i]); }/*from w w w .ja v a2 s. c o m*/ return params; }
From source file:com.astra.ses.spell.dev.commands.GetExplorerSelection.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { /*// w w w . j a v a2 s. c om * Return an array of Object if there are selected elements in the view * Otherwise null is returned */ Object[] result = null; if (PlatformUI.isWorkbenchRunning()) { IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWindow == null) { return null; } if (activeWindow.getActivePage() == null) { return null; } IViewPart explorerView = activeWindow.getActivePage().findView(ProcedureExplorerView.ID); if (explorerView != null) { ISelection selection = ((ProcedureExplorerView) explorerView).getCommonViewer().getSelection(); IStructuredSelection structuredSelection = (IStructuredSelection) selection; result = structuredSelection.toArray(); } } return result; }
From source file:com.astra.ses.spell.gui.model.watchvariables.WatchVariablesSelection.java
License:Open Source License
public static boolean allRegistered(IStructuredSelection selection) { Object[] elements = selection.toArray(); return allRegistered(elements); }
From source file:com.astra.ses.spell.gui.model.watchvariables.WatchVariablesSelection.java
License:Open Source License
public static boolean noneRegistered(IStructuredSelection selection) { Object[] elements = selection.toArray(); return noneRegistered(elements); }
From source file:com.astra.ses.spell.gui.model.watchvariables.WatchVariablesSelection.java
License:Open Source License
public static boolean anyRegistered(IStructuredSelection selection) { Object[] elements = selection.toArray(); return anyRegistered(elements); }
From source file:com.astra.ses.spell.gui.model.watchvariables.WatchVariablesSelection.java
License:Open Source License
public static boolean anyUnregistered(IStructuredSelection selection) { Object[] elements = selection.toArray(); return anyUnregistered(elements); }
From source file:com.astra.ses.spell.gui.views.controls.watchvariables.WatchVariablesPage.java
License:Open Source License
/************************************************************************** * Subscribe to selected variables./*from ww w . ja v a2 s .com*/ *************************************************************************/ public void subscribeSelected() { IStructuredSelection sel = (IStructuredSelection) m_viewer.getSelection(); Object[] list = sel.toArray(); for (Object obj : list) { VariableData var = (VariableData) obj; /* * Prepare command arguments */ HashMap<String, String> args = new HashMap<String, String>(); args.put(IWatchCommandArgument.PROCEDURE_ID, m_procId); args.put(IWatchCommandArgument.VARIABLE_NAME, var.name); args.put(IWatchCommandArgument.VARIABLE_GLOBAL, new Boolean(var.isGlobal).toString()); /* * Execute the command */ CommandResult result = (CommandResult) CommandHelper.execute(WatchVariable.ID, args); if (result == CommandResult.SUCCESS) { var.isRegistered = true; } } showRegisteredNow(); }