Package org.eclipse.ui

Examples of org.eclipse.ui.IWorkbenchWindow


    }
    fromProject(event, project, action);
  }

  private void fromProject(ExecutionEvent event, IProject project, String action) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

    IFile file = project.getFile("conf/routes");
    IEditorPart editorPart;
    if (file.exists()) {
      try {
        editorPart = FilesAccess.openFile(file);
        if (action != null) {
          FilesAccess.goToLineContaining(editorPart, action);
        }
      } catch (CoreException e) {
        // Never happens
        e.printStackTrace();
      }
    } else {
      MessageDialog.openInformation(
          window.getShell(),
          "Playclipse",
          "The file conf/routes can't be found, create it first");
    }
  }
View Full Code Here


   */
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    String action = null;
    // probably a selection from the explorer popup.
    IWorkbenchWindow win = HandlerUtil.getActiveWorkbenchWindow(event);
    ISelection activeMenuSelection = HandlerUtil.getActiveMenuSelection(event);
   
    IProject p  = null;
    if (activeMenuSelection instanceof IStructuredSelection) {
      IStructuredSelection selection = (IStructuredSelection)activeMenuSelection;
View Full Code Here

  }

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    // probably a selection from the explorer popup.
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
    ISelection activeMenuSelection = HandlerUtil.getActiveMenuSelection(event);

    boolean useJapid = false;
    String viewName = null;
    String controllerName = null;
View Full Code Here

    return ((IFileEditorInput) editorPart.getEditorInput()).getFile();
  }

  private static IWorkbenchPage getCurrentPage() {
    IWorkbench wb = PlatformUI.getWorkbench();
    IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
    IWorkbenchPage page = win.getActivePage();
    return page;
  }
View Full Code Here

public class RunRescripterHandler extends AbstractHandler {
  public RunRescripterHandler() { }

  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = getWindow(event);
    try {
      ITextEditor editor = getEditor();
      IEditorInput editorInput = editor.getEditorInput();
            IDocument document = editor.getDocumentProvider().getDocument(editorInput);
           
View Full Code Here

  private Mockery context = new Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }};
 
  @Test public void
  runs_script() throws IOException, CoreException {
    final IWorkbenchWindow window = context.mock(IWorkbenchWindow.class);
    final IFile file = context.mock(IFile.class);
    final ScriptRunner scriptRunner = context.mock(ScriptRunner.class);
    final ScriptStack scriptStack = context.mock(ScriptStack.class);
   
    final String contents = "contents";
View Full Code Here

 
  @Test public void
  runs_script_from_current_editor() throws ExecutionException {
    final RunScript runScript = context.mock(RunScript.class);
    final IFile file = context.mock(IFile.class);
    final IWorkbenchWindow window = context.mock(IWorkbenchWindow.class);
    final ITextEditor editor = context.mock(ITextEditor.class);
    final IFileEditorInput editorInput = context.mock(IFileEditorInput.class);
    final IDocumentProvider documentProvider = context.mock(IDocumentProvider.class);
    final IDocument document = context.mock(IDocument.class);
   
View Full Code Here

public class ConnectionEditorCall extends AbstractHandler implements IHandler {

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    // Get the view
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
    IWorkbenchPage page = window.getActivePage();
    MeclipseView view = (MeclipseView) page.findView(MeclipseView.ID);
    // Get the selection
    IStructuredSelection selection = (IStructuredSelection) view
        .getViewer().getSelection();
View Full Code Here

      if (_or) {
        final Location location = ((Location) model);
        final String uri = location.getUri();
        TargetPlatformActivator _instance = TargetPlatformActivator.getInstance();
        IWorkbench _workbench = _instance.getWorkbench();
        final IWorkbenchWindow window = _workbench.getActiveWorkbenchWindow();
        final IRunnableWithProgress _function = new IRunnableWithProgress() {
          public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            Shell _shell = window.getShell();
            Display _display = _shell.getDisplay();
            ReadAndDispatchProgressMonitorWrapper _readAndDispatchProgressMonitorWrapper = new ReadAndDispatchProgressMonitorWrapper(monitor, _display);
            final SubMonitor wpm = SubMonitor.convert(_readAndDispatchProgressMonitorWrapper, ("Creating content assist for " + uri), 100);
            try {
              Object _service = TargetPlatformProposalProvider.this.provisioningAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
              final IMetadataRepositoryManager repositoryManager = ((IMetadataRepositoryManager) _service);
              URI _uRI = new URI(uri);
              SubMonitor _newChild = wpm.newChild(90);
              final IMetadataRepository metadataRepository = repositoryManager.loadRepository(_uRI, _newChild);
              IQuery<IInstallableUnit> _iUAssistQuery = TargetPlatformProposalProvider.this.getIUAssistQuery();
              SubMonitor _newChild_1 = wpm.newChild(5);
              IQueryResult<IInstallableUnit> _query = metadataRepository.query(_iUAssistQuery, _newChild_1);
              final Set<IInstallableUnit> results = _query.toUnmodifiableSet();
              final Function1<IInstallableUnit, Boolean> _function = new Function1<IInstallableUnit, Boolean>() {
                public Boolean apply(final IInstallableUnit it) {
                  EList<IU> _ius = location.getIus();
                  final Function1<IU, String> _function = new Function1<IU, String>() {
                    public String apply(final IU it) {
                      return it.getID();
                    }
                  };
                  List<String> _map = ListExtensions.<IU, String>map(_ius, _function);
                  String _id = it.getId();
                  boolean _contains = _map.contains(_id);
                  return Boolean.valueOf((!_contains));
                }
              };
              Iterable<IInstallableUnit> _filter = IterableExtensions.<IInstallableUnit>filter(results, _function);
              final Procedure1<IInstallableUnit> _function_1 = new Procedure1<IInstallableUnit>() {
                public void apply(final IInstallableUnit it) {
                  String _id = it.getId();
                  IQuery<IInstallableUnit> _createIUQuery = QueryUtil.createIUQuery(_id);
                  SubMonitor _newChild = wpm.newChild(5);
                  final IQueryResult<IInstallableUnit> allVersions = metadataRepository.query(_createIUQuery, _newChild);
                  String _id_1 = it.getId();
                  Iterator<IInstallableUnit> _iterator = allVersions.iterator();
                  final Function1<IInstallableUnit, String> _function = new Function1<IInstallableUnit, String>() {
                    public String apply(final IInstallableUnit it) {
                      Version _version = it.getVersion();
                      return _version.toString();
                    }
                  };
                  Iterator<String> _map = IteratorExtensions.<IInstallableUnit, String>map(_iterator, _function);
                  String _join = IteratorExtensions.join(_map, ", ");
                  ICompletionProposal _createCompletionProposal = TargetPlatformProposalProvider.this.createCompletionProposal(_id_1, _join, TargetPlatformProposalProvider.IU, 0, context);
                  acceptor.accept(_createCompletionProposal);
                }
              };
              IterableExtensions.<IInstallableUnit>forEach(_filter, _function_1);
            } catch (final Throwable _t) {
              if (_t instanceof Exception) {
                final Exception e = (Exception)_t;
              } else {
                throw Exceptions.sneakyThrow(_t);
              }
            }
          }
        };
        final IRunnableWithProgress op = _function;
        window.run(false, true, op);
      }
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
View Full Code Here

        final IU iu = ((IU) model);
        Location _location = iu.getLocation();
        final String uri = _location.getUri();
        TargetPlatformActivator _instance = TargetPlatformActivator.getInstance();
        IWorkbench _workbench = _instance.getWorkbench();
        final IWorkbenchWindow window = _workbench.getActiveWorkbenchWindow();
        Shell _shell = window.getShell();
        Display _display = _shell.getDisplay();
        final IRunnableWithProgress op = this.versionProposalRunnable(uri, iu, prefix, _display, context, acceptor);
        window.run(false, true, op);
      }
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IWorkbenchWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.