Example usage for org.eclipse.jface.dialogs ProgressMonitorDialog open

List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog open

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs ProgressMonitorDialog open.

Prototype

@Override
    public int open() 

Source Link

Usage

From source file:SaveHandler.java

License:Open Source License

    @Execute
   public void execute(
         IEclipseContext context,/*w  ww  .ja  va2 s  .c  o m*/
         @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
         @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
         throws InvocationTargetException, InterruptedException {
      final IEclipseContext pmContext = context.createChild();

      ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
      dialog.open();
      dialog.run(true, true, new IRunnableWithProgress() {
         public void run(IProgressMonitor monitor)
               throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
               Object clientObject = contribution.getObject();
//               ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$
//                     pmContext, null);
            }
         }
      });

      if (pmContext instanceof IDisposable) {
         ((IDisposable) pmContext).dispose();
      }
   }

From source file:$group_id$.core.handlers.SaveHandler.java

License:Open Source License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();
    dialog.run(true, true, new IRunnableWithProgress() {
        @Override//  w w  w .  j a va  2s. c  om
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
                //               Object clientObject = contribution.getObject();
                //               ContextInjectionFactory.invoke(clientObject, Persist.class, //\$NON-NLS-1\$
                //                     pmContext, null);
            }
        }
    });

    pmContext.dispose();
}

From source file:al.gov.asp.smc.e4.linkapp.handlers.SaveHandler.java

License:Open Source License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();
    dialog.run(true, true, new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
            }/*from  w ww  .j a v a 2  s  .co m*/
        }
    });

    pmContext.dispose();
}

From source file:application.e4.handlers.SaveHandler.java

License:Open Source License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();
    dialog.run(true, true, new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
                Object clientObject = contribution.getObject();
                //               ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$
                //                     pmContext, null);
            }//from   w  ww  . j  a  va  2s.c  o m
        }
    });

    pmContext.dispose();
}

From source file:au.gov.ga.earthsci.application.handlers.SaveHandler.java

License:Apache License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();
    dialog.run(true, true, new IRunnableWithProgress() {
        @Override/* w  w w. jav a2 s . c o m*/
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
                //Object clientObject = contribution.getObject();
                //ContextInjectionFactory.invoke(clientObject, Persist.class, pmContext, null);
            }
        }
    });

    pmContext.dispose();
}

From source file:ch.hsr.ifs.cdt.metriculator.tagcloud.views.TagCloudViewPart.java

License:Open Source License

private void createSideTab(SashForm form) {
    Composite parent = new Composite(form, SWT.NONE);
    parent.setLayout(new GridLayout());
    parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    options = new CloudOptionsComposite(parent, SWT.NONE, viewer) {

        protected Group addLayoutButtons(Composite parent) {
            Group buttons = super.addLayoutButtons(parent);

            Label l = new Label(buttons, SWT.NONE);
            l.setText("Scale");
            final Combo scale = new Combo(buttons, SWT.DROP_DOWN | SWT.READ_ONLY);
            scale.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
            scale.setItems(new String[] { "linear", "logarithmic" });
            scale.select(1);/*from w  w  w .j  ava 2  s  .co m*/
            scale.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    switch (scale.getSelectionIndex()) {
                    case 0:
                        labelProvider.setScale(TypeLabelProvider.Scaling.LINEAR);
                        break;
                    case 1:
                        labelProvider.setScale(TypeLabelProvider.Scaling.LOGARITHMIC);
                        break;
                    default:
                        break;
                    }
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });
            l = new Label(buttons, SWT.NONE);
            l.setText("X Axis Variation");
            final Combo xAxis = new Combo(buttons, SWT.DROP_DOWN | SWT.READ_ONLY);
            xAxis.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
            xAxis.setItems(new String[] { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" });
            xAxis.select(2);
            xAxis.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    String item = xAxis.getItem(xAxis.getSelectionIndex());
                    layouter.setOption(DefaultLayouter.X_AXIS_VARIATION, Integer.parseInt(item));

                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });

            l = new Label(buttons, SWT.NONE);
            l.setText("Y Axis Variation");
            final Combo yAxis = new Combo(buttons, SWT.DROP_DOWN | SWT.READ_ONLY);
            yAxis.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
            yAxis.setItems(new String[] { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" });
            yAxis.select(1);
            yAxis.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    String item = yAxis.getItem(yAxis.getSelectionIndex());
                    layouter.setOption(DefaultLayouter.Y_AXIS_VARIATION, Integer.parseInt(item));
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });

            Button run = new Button(buttons, SWT.NONE);
            run.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            run.setText("Re-Position");
            run.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    final ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                            viewer.getControl().getShell());
                    dialog.setBlockOnOpen(false);
                    dialog.open();
                    dialog.getProgressMonitor().beginTask("Layouting tag cloud...", 100);
                    viewer.reset(dialog.getProgressMonitor(), false);
                    dialog.close();
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });
            Button layout = new Button(buttons, SWT.NONE);
            layout.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            layout.setText("Re-Layout");
            layout.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    ProgressMonitorDialog dialog = new ProgressMonitorDialog(viewer.getControl().getShell());
                    dialog.setBlockOnOpen(false);
                    dialog.open();
                    dialog.getProgressMonitor().beginTask("Layouting tag cloud...", 200);
                    viewer.setInput(viewer.getInput(), dialog.getProgressMonitor());
                    viewer.reset(dialog.getProgressMonitor(), false);
                    dialog.close();
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });
            return buttons;
        };

    };
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    options.setLayoutData(gd);
}

From source file:com.aljoschability.defectr.ui.handlers.SaveHandler.java

License:Open Source License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();
    dialog.run(true, true, new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
                Object clientObject = contribution.getObject();
                System.out.println(clientObject);
                //               ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$
                // pmContext, null);
            }/*w w  w .j a v  a  2  s.c  o  m*/
        }
    });

    pmContext.dispose();
}

From source file:com.beck.ep.team.internal.TeamListBuilder.java

License:BSD License

public String[] createList(Shell shell, IProject project) throws Exception {
    error = null;//from   www  .j  av a2 s.  c  o  m
    RepositoryProvider provider = RepositoryProvider.getProvider(project);
    if (provider == null) {
        error = "No Repository provider exist. Project: " + project.getName();
        return null;
    }
    IListBuilder lb = newListBuilder(provider.getID());
    if (lb != null) {
        String[] sa = lb.createList(shell, project);
        error = lb.getError();
        return sa;
    }

    Subscriber subscriber = provider.getSubscriber();

    SyncInfoSet set = new SyncInfoSet();
    //set.add(SyncInfo.CONFLICTING);

    Filter filter = new Filter();
    ProgressMonitorDialog monitor = new ProgressMonitorDialog(shell);
    monitor.setCancelable(true);
    monitor.open();
    IResource[] members = project.members();
    subscriber.collectOutOfSync(members, IResource.DEPTH_INFINITE, set, monitor.getProgressMonitor());
    monitor.close();

    SyncInfo[] infos = set.getNodes(filter);
    String[] sa = new String[infos.length];
    for (int i = 0; i < infos.length; i++) {
        sa[i] = infos[i].getLocal().getProjectRelativePath().toString();
    }
    return sa;
}

From source file:com.binge.workforce.app.handlers.SaveHandler.java

License:Open Source License

@Execute
public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
        @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
        throws InvocationTargetException, InterruptedException {
    final IEclipseContext pmContext = context.createChild();

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
    dialog.open();
    dialog.run(true, true, new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            pmContext.set(IProgressMonitor.class.getName(), monitor);
            if (contribution != null) {
                Object clientObject = contribution.getObject();
                //               ContextInjectionFactory.invoke(clientObject, Persist.class, //$NON-NLS-1$
                //                     pmContext, null);
            }//from w  w  w.  java2s  .c o m
        }
    });

    if (pmContext instanceof IDisposable) {
        ((IDisposable) pmContext).dispose();
    }
}

From source file:com.ecfeed.ui.dialogs.CoverageCalculator.java

License:Open Source License

public boolean calculateCoverage() {
    // CurrentlyChangedCases are null if deselection left no test cases selected, 
    // hence we can just clear tuple map and set results to 0
    if (fCurrentlyChangedCases == null) {
        for (Map<List<OrderedChoice>, Integer> tupleMap : fTuples) {
            tupleMap.clear();//from w ww  .ja va  2  s .  c  o  m
        }
        // set results to zero
        resetResults();
        fCurrentlyChangedCases = new ArrayList<>();
        return true;
    } else {
        ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(Display.getDefault().getActiveShell());
        try {
            CalculatorRunnable runnable = new CalculatorRunnable();
            progressDialog.open();
            progressDialog.run(true, true, runnable);
            if (runnable.isCanceled) {
                return false;
            } else {
                fCurrentlyChangedCases.clear();
                return true;
            }

        } catch (InvocationTargetException e) {
            MessageDialog.openError(Display.getDefault().getActiveShell(), "Exception",
                    "Invocation: " + e.getCause());
            return false;
        } catch (InterruptedException e) {
            MessageDialog.openError(Display.getDefault().getActiveShell(), "Exception",
                    "Interrupted: " + e.getMessage());
            e.printStackTrace();
            return false;
        }
    }

}