List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog ProgressMonitorDialog
public ProgressMonitorDialog(Shell parent)
From source file:com.genuitec.eclipse.gerrit.tools.internal.fbranches.BranchingUtils.java
License:Open Source License
public static boolean deleteBranches(Shell shell, final Repository repository, final List<Ref> toDelete) { final List<Ref> unmerged = new ArrayList<Ref>(); try {//from w w w . jav a 2s .com new ProgressMonitorDialog(shell).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { unmerged.addAll(deleteBranches(repository, toDelete, false, monitor)); } }); } catch (InvocationTargetException e1) { RepositoryUtils.handleException(e1); return false; } catch (InterruptedException e1) { // ignore return false; } if (!unmerged.isEmpty()) { MessageDialog messageDialog = new UnmergedBranchDialog<Ref>(shell, unmerged); if (messageDialog.open() != Window.OK) return false; try { new ProgressMonitorDialog(shell).run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { deleteBranches(repository, toDelete, true, monitor); } }); } catch (InvocationTargetException e1) { RepositoryUtils.handleException(e1); return false; } catch (InterruptedException e1) { // ignore return false; } } return true; }
From source file:com.genuitec.eclipse.gerrit.tools.internal.fbranches.commands.CreateFeatureBranchCommand.java
License:Open Source License
@Override protected void execute(ExecutionEvent event, List<Repository> repositories, String branchRef) throws ExecutionException { Shell shell = HandlerUtil.getActiveShell(event); //fetch remote branches for (Repository repository : repositories) { RepositoryUtils.fetchOrigin(shell, repository); }//from ww w . j a va 2 s . c om //configure branch creation CreateFeatureBranchDialog createFeatureBranchDialog = new CreateFeatureBranchDialog(shell, repositories); if (createFeatureBranchDialog.open() != IDialogConstants.OK_ID) { return; } String userId = RepositoryUtils.getUserId(repositories); //perform branch operation for (Repository repository : repositories) { try { ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); final CreateBranchOperation op = new CreateBranchOperation(progressDialog.getShell(), event, repository, userId, createFeatureBranchDialog.getSettings()); progressDialog.run(true, true, op); } catch (InterruptedException e) { //ignore } catch (Exception e) { RepositoryUtils.handleException(e); } } return; }
From source file:com.genuitec.eclipse.gerrit.tools.internal.fbranches.commands.MergeStableIntoCurrentBranchCommand.java
License:Open Source License
@Override protected void execute(ExecutionEvent event, List<Repository> repositories, String branchRef) throws ExecutionException { //perform branch operation Shell shell = HandlerUtil.getActiveShell(event); for (Repository repository : repositories) { try {/*from w ww. j av a 2s.co m*/ if (!canMerge(repository)) { continue; } ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); final MergeStableIntoCurrentBranchOperation op = new MergeStableIntoCurrentBranchOperation(event, branchRef, repository); progressDialog.run(true, true, op); } catch (InterruptedException e) { //ignore } catch (Exception e) { RepositoryUtils.handleException(e); } } }
From source file:com.genuitec.eclipse.gerrit.tools.internal.gps.commands.ExportProjectsHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShell(event); //first open the file FileDialog fd = new FileDialog(shell, SWT.SAVE); fd.setText("Export Gerrit Project Set file"); fd.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); String[] filterExt = { "*.gps" }; fd.setOverwrite(true);// ww w .j a v a 2 s. co m fd.setFilterExtensions(filterExt); String selected = fd.open(); if (selected != null) { GpsFile gpsFile = new GpsFile(); List<IProject> projects = new ExportProjectsDialog(shell).select(); if (projects == null || projects.isEmpty()) { return null; } try { ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); progressDialog.run(true, true, new ExportOperation(gpsFile, progressDialog, projects)); File f = new File(selected); if (f.isFile()) { f.delete(); } FileOutputStream fos = new FileOutputStream(selected, false); try { gpsFile.saveToStream(fos); } finally { fos.close(); } } catch (InterruptedException e) { //ignore } catch (Exception e) { GerritToolsPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, GerritToolsPlugin.PLUGIN_ID, e.getLocalizedMessage(), e)); MessageDialog.openError(shell, "Import", e.getLocalizedMessage()); } } return null; }
From source file:com.genuitec.eclipse.gerrit.tools.internal.gps.commands.ImportProjectsHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShell(event); if (shell == null) { shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); }/*from w w w. j a v a 2 s .c om*/ String fileName = event.getParameter("file"); //$NON-NLS-1$ if (fileName == null) { //first open the file FileDialog fd = new FileDialog(shell, SWT.OPEN); fd.setText("Import Gerrit Project Set file"); fd.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); String[] filterExt = { "*.gps" }; //$NON-NLS-1$ fd.setFilterExtensions(filterExt); fileName = fd.open(); } if (fileName != null) { GpsFile gpsFile = new GpsFile(); try { FileInputStream fis = new FileInputStream(fileName); try { gpsFile.loadFromStream(fis); } finally { fis.close(); } ImportProjectsDialog importDialog = new ImportProjectsDialog(shell, gpsFile); if (importDialog.open() != IDialogConstants.OK_ID) { return null; } ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); progressDialog.run(true, true, new ImportOperation(gpsFile, importDialog.getSettings(), progressDialog)); } catch (InterruptedException e) { //ignore } catch (Exception e) { GerritToolsPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, GerritToolsPlugin.PLUGIN_ID, e.getLocalizedMessage(), e)); MessageDialog.openError(shell, "Import", e.getLocalizedMessage()); } } return null; }
From source file:com.genuitec.eclipse.gerrit.tools.internal.utils.commands.TagAndPushHandler.java
License:Open Source License
@Override protected Object internalExecute(ExecutionEvent event) throws Exception { IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); final Shell shell = HandlerUtil.getActiveShell(event); List<Repository> repositories = new ArrayList<Repository>(); //acquire the list of repositories for (Object o : selection.toArray()) { RepositoryNode node = (RepositoryNode) o; repositories.add(node.getRepository()); assert node.getRepository() != null; }// w w w .ja v a 2s . c om //configure tagging operation TagAndPushDialog tagAndPushConfigDialog = new TagAndPushDialog(shell, repositories); if (tagAndPushConfigDialog.open() != IDialogConstants.OK_ID) { return null; } //perform tagging operation try { ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); final TagAndPushOperation op = new TagAndPushOperation(progressDialog.getShell(), repositories, tagAndPushConfigDialog.getSettings()); progressDialog.run(true, true, op); shell.getDisplay().asyncExec(new Runnable() { public void run() { if (op.getResult().getSeverity() >= IStatus.WARNING) { Policy.getStatusHandler().show(op.getResult(), "Results of the operation"); } else { MessageDialog.openInformation(shell, "Create and Push Tag", "Repositories has been successfully tagged."); } } }); } catch (InterruptedException e) { //ignore } catch (Exception e) { GerritToolsPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, GerritToolsPlugin.PLUGIN_ID, e.getLocalizedMessage(), e)); MessageDialog.openError(shell, "Create and Push Tag", e.getLocalizedMessage()); } return null; }
From source file:com.genuitec.eclipse.gerrit.tools.utils.RepositoryUtils.java
License:Open Source License
public static void fetchOrigin(Shell shell, final Repository repository) { //perform branch operation try {//from w w w .ja v a2 s. c om ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); progressDialog.run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { monitor.beginTask("Fetching updates from origin", 100); FetchOperationUI fetchOp = new FetchOperationUI(repository, new RemoteConfig(repository.getConfig(), "origin"), 3000, false); //$NON-NLS-1$ fetchOp.setCredentialsProvider(new EGitCredentialsProvider()); fetchOp.execute(new SubProgressMonitor(monitor, 100)); } catch (Exception e) { throw new InvocationTargetException(e); } } }); } catch (InterruptedException e) { //ignore } catch (Exception e) { RepositoryUtils.handleException(e); } }
From source file:com.gigaspaces.azure.runnable.CacheAccountWithProgressWindow.java
License:Open Source License
@Override public void run() { ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); try {/*w w w . j a v a2 s. c o m*/ dialog.run(true, true, this); dialog.close(); isCompletedSuccesfully = true; } catch (InvocationTargetException e) { MessageUtil.displayErrorDialog(shell, Messages.loadingCred, message); isCompletedSuccesfully = false; } catch (InterruptedException e) { } }
From source file:com.gigaspaces.azure.runnable.FetchDeploymentsForHostedServiceWithProgressWindow.java
License:Open Source License
@Override public void run() { ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); try {//from w w w .j a v a 2 s . co m dialog.run(true, true, this); dialog.close(); } catch (InvocationTargetException e) { MessageUtil.displayErrorDialog(shell, com.gigaspaces.azure.wizards.Messages.fetchingDeploymentsTitle, e.getMessage()); Activator.getDefault().log(Messages.error, e); } catch (InterruptedException e) { } }
From source file:com.gigaspaces.azure.runnable.LoadAccountWithProgressWindow.java
License:Open Source License
@Override public void run() { ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell); try {/*from www .j a v a 2 s .co m*/ dialog.run(true, true, this); dialog.close(); PreferenceUtil.setLoaded(true); } catch (InvocationTargetException e) { // special check for Java 1.6 and bouncycastle not in classpath error if (Messages.importDlgMsgJavaVersion.equals(e.getMessage())) { MessageUtil.displayErrorDialog(shell, Messages.loadingCred, Messages.importDlgMsgJavaVersion); } else { MessageUtil.displayErrorDialog(shell, Messages.loadingCred, Messages.loadingAccountError); } Activator.getDefault().log(Messages.error, e); PreferenceUtil.setLoaded(false); } catch (InterruptedException e) { // cancel pressed, so user might not be interested in loading data again PreferenceUtil.setLoaded(true); } }