List of usage examples for org.eclipse.jface.operation IRunnableWithProgress IRunnableWithProgress
IRunnableWithProgress
From source file:com.htmlhifive.tools.wizard.RemoteContentManager.java
License:Apache License
private static IRunnableWithProgress getSiteDownLoad(final ResultStatus resultStatus, final String urlStr, final DownloadModule downloadModule) { return new IRunnableWithProgress() { @Override/*from w ww . ja v a 2s.c om*/ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.setTaskName(Messages.PI0141.format(urlStr)); BufferedInputStream bufferIs = null; try { IConnectMethod method = ConnectMethodFactory.getMethod(urlStr, true); if (!H5IOUtils.isClassResources(urlStr)) { method.setConnectionTimeout(PluginConstant.URL_LIBRARY_LIST_CONNECTION_TIMEOUT); method.setProxy(downloadModule.getProxyService()); } InputStream is = method.getInputStream(); if (is == null) { resultStatus.log(Messages.SE0046, urlStr); } else { final int content = method.getContentLength(); monitor.beginTask(Messages.PI0142.format(urlStr), content); bufferIs = new BufferedInputStream(is) { private int current = 0; @Override public synchronized int read() throws IOException { int result = super.read(); current += result * 16; monitor.subTask(Messages.PI0143.format(current, content, urlStr)); monitor.worked(result * 16); return result; } }; LibraryFileParser parser = LibraryFileParserFactory.createParser(bufferIs); LibraryList libraryList = parser.getLibraryList(); libraryList.setLastModified(method.getLastModified()); if (H5IOUtils.isClassResources(urlStr)) { libraryList.setSource(null); // ??. } else { libraryList.setSource(urlStr); } H5WizardPlugin.getInstance().setLibraryList(libraryList); // ??????. resultStatus.setSuccess(true); // ?????. monitor.done(); } } catch (ParseException e) { resultStatus.log(e, Messages.SE0046, urlStr); } catch (MalformedURLException e) { resultStatus.log(e, Messages.SE0046, urlStr); } catch (IOException e) { resultStatus.log(e, Messages.SE0046, urlStr); } finally { IOUtils.closeQuietly(bufferIs); //Thread.currentThread().wait(5000); } } }; }
From source file:com.htmlhifive.tools.wizard.ui.ProjectCreationWizard.java
License:Apache License
/** * ???Runnable ?.//from w w w . j a v a 2 s .c o m * * @return ???Runnable. */ private IRunnableWithProgress getExtractRunnnable(final ResultStatus logger) { return new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (monitor == null) { // ?. monitor = new NullProgressMonitor(); } // ??. BaseProject baseProject = structureSelectPage.getBaseProject(); if (baseProject == null) { // ??. H5LogUtils.putLog(null, Messages.SE0048); //H5LogUtils.showLog(null, Messages.SE0043, Messages.SE0048); logger.setSuccess(false); return; } // . monitor.beginTask(Messages.PI0101.format(), 10000); // nature, project-download, zip-extract, replace, reflesh // create the project try { final IProject proj = structureSelectPage.getProjectHandle(); // . proj.setDefaultCharset("UTF-8", monitor); // ?(Core???). downloadModule.downloadProject(monitor, 2000, logger, baseProject, proj); // 2000 // SE0061=INFO,????? logger.log(Messages.SE0061); monitor.worked(1000); // 1000 // ?. for (com.htmlhifive.tools.wizard.library.xml.File file : baseProject.getReplace().getFile()) { H5IOUtils.convertProjectName(getShell(), proj, file.getName()); // SE0069=INFO,({0})??????? logger.log(Messages.SE0069, file.getName()); } // Nature. if (baseProject.getNatures() != null) { for (Nature nature : baseProject.getNatures().getNature()) { try { // SE0065=INFO,Nature{0}??? logger.log(Messages.SE0065, nature.getId()); addNature(proj, monitor, nature.getId()); // SE0066=INFO,Nature{0}???? logger.log(Messages.SE0066, nature.getId()); } catch (CoreException e) { // ?????. // SE0067=INFO,Nature{0}????? logger.logIgnoreSetSuccess(e, Messages.SE0067, nature.getId()); // SE0031=ERROR,???????????name={0}, natureId={1} //H5LogUtils.putLog(e, Messages.SE0031, nature.getName(), nature.getId()); H5LogUtils.showLog(e, Messages.SE0032, Messages.SE0031, nature.getName(), nature.getId()); } } } monitor.worked(1000); // SE0062=INFO,???????? logger.log(Messages.SE0062); // ?. final IProject project = structureSelectPage.getProjectHandle(); // ? downloadModule.downloadLibrary(monitor, 5000, logger, H5WizardPlugin.getInstance().getSelectedLibrarySortedSet(), project); // 5000 // ???. project.refreshLocal(IResource.DEPTH_ONE, monitor); // SE0104=INFO,???? logger.log(Messages.SE0104); monitor.worked(1000); } catch (OperationCanceledException e) { // ??. throw new InterruptedException(e.getMessage()); } catch (CoreException e) { // SE0023=ERROR,???????? logger.log(e, Messages.SE0023, ""); throw new InvocationTargetException(e, Messages.SE0023.format()); } finally { monitor.done(); } } }; }
From source file:com.htmlhifive.tools.wizard.ui.property.LibraryImportPropertyPage.java
License:Apache License
/** * ???Runnable ?.// www .j ava 2 s.co m * * @param logger * @return ???Runnable */ private IRunnableWithProgress getDownloadRunnnable(final ResultStatus logger) { return new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { DownloadModule downloadModule = new DownloadModule(); try { if (monitor == null) { // ?. monitor = new NullProgressMonitor(); } // . monitor.beginTask(Messages.PI0103.format(), 10000); IJavaScriptProject jsProject = getJavaScriptProject(); // ????. // ? downloadModule.downloadLibrary(monitor, 8000, logger, H5WizardPlugin.getInstance().getSelectedLibrarySortedSet(), jsProject.getProject()); // 8000 // ???. jsProject.getProject().refreshLocal(IResource.DEPTH_ONE, monitor); // SE0104=INFO,???? logger.log(Messages.SE0104); monitor.subTask(Messages.SE0104.format()); monitor.worked(2000); } catch (OperationCanceledException e) { // ??. throw new InterruptedException(e.getMessage()); } catch (CoreException e) { // SE0023=ERROR,???????? logger.log(e, Messages.SE0023, ""); throw new InvocationTargetException(e, Messages.SE0023.format()); } finally { downloadModule.close(); monitor.done(); } } }; }
From source file:com.htmlhifive.tools.wizard.ui.property.LibraryImportPropertyPage.java
License:Apache License
/** * Nature???Runnable ?./* w w w.j a v a2s. c o m*/ * * @param logger * @return Nature???Runnable */ private static IRunnableWithProgress getAddNatureRunnnable(final ResultStatus logger, final IProject project, final String natureId) { return new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { // SE0065=INFO,Nature{0}??? logger.log(Messages.SE0065, natureId); ProjectCreationWizard.addNature(project, monitor, natureId); // SE0066=INFO,Nature{0}???? logger.log(Messages.SE0066, natureId); } catch (CoreException e) { // ?????. // SE0067=INFO,Nature{0}????? logger.logIgnoreSetSuccess(e, Messages.SE0067, natureId); // SE0031=ERROR,???????????name={0}, natureId={1} //H5LogUtils.putLog(e, Messages.SE0031, nature.getName(), nature.getId()); H5LogUtils.showLog(e, Messages.SE0032, Messages.SE0031, "", natureId); } } }; }
From source file:com.hudson.hibernatesynchronizer.popup.actions.RemoveRelatedFiles.java
License:GNU General Public License
/** * @see IActionDelegate#run(IAction)/* w ww . ja va 2 s. co m*/ */ public void run(IAction action) { final Shell shell = new Shell(); if (MessageDialog.openConfirm(shell, "File Removal Confirmation", "Are you sure you want to delete all related class and resources to the selected mapping files?")) { ISelectionProvider provider = part.getSite().getSelectionProvider(); if (null != provider) { if (provider.getSelection() instanceof StructuredSelection) { StructuredSelection selection = (StructuredSelection) provider.getSelection(); Object[] obj = selection.toArray(); final IFile[] files = new IFile[obj.length]; IProject singleProject = null; boolean isSingleProject = true; for (int i = 0; i < obj.length; i++) { if (obj[i] instanceof IFile) { IFile file = (IFile) obj[i]; files[i] = file; if (null == singleProject) singleProject = file.getProject(); if (!singleProject.getName().equals(file.getProject().getName())) { isSingleProject = false; } } } if (isSingleProject) { final IProject project = singleProject; ProgressMonitorDialog dialog = new ProgressMonitorDialog(part.getSite().getShell()); try { dialog.run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { RemoveRelatedFilesRunnable runnable = new RemoveRelatedFilesRunnable( project, files, monitor, shell); ResourcesPlugin.getWorkspace().run(runnable, monitor); } catch (Exception e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }); } catch (Exception e) { } } else { HSUtil.showError("The selected files must belong to a single project", shell); } } } } }
From source file:com.hudson.hibernatesynchronizer.popup.actions.SynchronizeFiles.java
License:GNU General Public License
/** * @see IActionDelegate#run(IAction)// w ww .j av a 2s . co m */ public void run(IAction action) { Shell shell = new Shell(); final ISelectionProvider provider = part.getSite().getSelectionProvider(); if (null != provider) { if (provider.getSelection() instanceof StructuredSelection) { ProgressMonitorDialog dialog = new ProgressMonitorDialog(part.getSite().getShell()); try { dialog.run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { IStructuredSelection selection = (StructuredSelection) provider.getSelection(); monitor.beginTask("Synchronizing files...", 2 + (selection.toArray().length * 14)); exec(selection, monitor); } catch (Exception e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }); } catch (Exception e) { } } } }
From source file:com.hudson.hibernatesynchronizer.wizard.NewConfigurationWizard.java
License:GNU General Public License
/** * This method is called when 'Finish' button is pressed in the wizard. We * will create an operation and run it using wizard as execution context. *//*from www . j a va 2s.c o m*/ public boolean performFinish() { final String containerName = page.getContainerName(); final String fileName = page.getFileName(); final String databaseName = page.getDatabaseName(); final String appServerName = page.getApplicationServerName(); final String databaseURL = page.getDatabaseURL(); final String driverClass = page.getDriverClass(); final String username = page.getUsername(); final String password = page.getPassword(); final String sessionFactoryName = page.getSessionFactoryName(); final String datasourceName = page.getDatasourceName(); final String datasourceJNDIUrl = page.getDatasourceJNDIUrl(); final String datasourceJNDIClassName = page.getDatasourceJNDIClassName(); final String datasourceUserName = page.getDatasourceUserName(); final String datasourcePassword = page.getDatasourcePassword(); IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException { try { doFinish(containerName, fileName, databaseName, appServerName, databaseURL, driverClass, username, password, datasourceName, datasourceJNDIUrl, datasourceJNDIClassName, datasourceUserName, datasourcePassword, sessionFactoryName, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }; try { getContainer().run(true, false, op); } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { e.getTargetException().printStackTrace(); Throwable realException = e.getTargetException(); MessageDialog.openError(getShell(), "Error", realException.getMessage()); return false; } return true; }
From source file:com.hudson.hibernatesynchronizer.wizard.NewMappingWizard.java
License:GNU General Public License
/** * This method is called when 'Finish' button is pressed in the wizard. We * will create an operation and run it using wizard as execution context. *//* ww w . j a v a 2 s . com*/ public boolean performFinish() { final String containerName = page.getContainerName(); final List tables = page.getTables(); final String packageName = page.getPackage(); final Properties props = page.getProperties(); Plugin.saveProperty(page.project.getProject(), "package", packageName); int foreignKeys = 0; for (Iterator i = tables.iterator(); i.hasNext();) { DBTable tbl = (DBTable) i.next(); tbl.setProperties(props); foreignKeys += tbl.getForeignKeys().size(); } try { Template template = Constants.templateGenerator.getTemplate("Mapping.vm"); Connection c = page.getConnection(null); final MappingWizardRunnable runnable = new MappingWizardRunnable(containerName, tables, packageName, props, template, c, getShell()); ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); try { dialog.run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { ResourcesPlugin.getWorkspace().run(runnable, monitor); } catch (Exception e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }); } catch (Exception e) { } finally { if (null != c) c.close(); } if (null != runnable.files && runnable.files.length > 0) { AddMappingReference.addMappingReference(page.project.getProject(), runnable.files, false, getShell()); } } catch (Exception e) { HSUtil.showError(e.getMessage(), getShell()); } return true; }
From source file:com.hudson.hibernatesynchronizer.wizard.NewMappingWizardPage.java
License:GNU General Public License
public Composite addConfiguration(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout);//from w w w. jav a2 s . c o m layout.numColumns = 3; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); label.setText("&Container:"); containerText = new Text(container, SWT.BORDER | SWT.SINGLE); containerText.setEnabled(false); containerText.setBackground(new Color(null, 255, 255, 255)); GridData gd = new GridData(); gd.widthHint = 250; containerText.setLayoutData(gd); containerText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); Button containerButton = new Button(container, SWT.NATIVE); containerButton.setText("Browse"); containerButton.addMouseListener(new ContainerMouseListener(this)); label = new Label(container, SWT.NULL); gd = new GridData(); gd.grabExcessHorizontalSpace = true; gd.horizontalSpan = 3; label.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText("&Driver:"); driverText = new Text(container, SWT.BORDER | SWT.SINGLE); driverText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); driverText.setEnabled(false); driverText.setBackground(new Color(null, 255, 255, 255)); gd = new GridData(); gd.widthHint = 250; driverText.setLayoutData(gd); Button driverButton = new Button(container, SWT.NATIVE); driverButton.setText("Browse"); driverButton.addMouseListener(new DriverMouseListener(this)); label = new Label(container, SWT.NULL); label.setText("&Database URL:"); databaseUrlText = new Text(container, SWT.BORDER | SWT.SINGLE); databaseUrlText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); gd = new GridData(); gd.horizontalSpan = 2; gd.widthHint = 250; databaseUrlText.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText("&Username:"); usernameText = new Text(container, SWT.BORDER | SWT.SINGLE); usernameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); gd = new GridData(); gd.horizontalSpan = 2; gd.widthHint = 150; usernameText.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText("&Password:"); passwordText = new Text(container, SWT.BORDER | SWT.SINGLE); passwordText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); passwordText.setEchoChar('*'); gd = new GridData(); gd.horizontalSpan = 2; gd.widthHint = 150; passwordText.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText("Table pattern:"); tablePattern = new Text(container, SWT.BORDER | SWT.SINGLE); tablePattern.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); tablePattern.setEnabled(true); tablePattern.setBackground(new Color(null, 255, 255, 255)); gd = new GridData(); gd.horizontalSpan = 2; gd.widthHint = 250; tablePattern.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText("Schema pattern:"); schemaPattern = new Text(container, SWT.BORDER | SWT.SINGLE); schemaPattern.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); schemaPattern.setEnabled(true); schemaPattern.setBackground(new Color(null, 255, 255, 255)); gd = new GridData(); gd.horizontalSpan = 2; gd.widthHint = 250; schemaPattern.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText("Tables"); table = new Table(container, SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.CHECK); table.setVisible(true); table.setLinesVisible(false); table.setHeaderVisible(false); table.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { dialogChanged(); } public void widgetDefaultSelected(SelectionEvent e) { } }); GridData data = new GridData(); data.heightHint = 150; data.widthHint = 250; table.setLayoutData(data); // create the columns TableColumn nameColumn = new TableColumn(table, SWT.LEFT); ColumnLayoutData nameColumnLayout = new ColumnWeightData(100, false); // set columns in Table layout TableLayout tableLayout = new TableLayout(); tableLayout.addColumnData(nameColumnLayout); table.setLayout(tableLayout); Composite buttonContainer = new Composite(container, SWT.NULL); buttonContainer.setLayout(new GridLayout(1, true)); gd = new GridData(); gd.verticalAlignment = GridData.BEGINNING; gd.horizontalAlignment = GridData.BEGINNING; buttonContainer.setLayoutData(gd); tableRefreshButton = new Button(buttonContainer, SWT.PUSH); tableRefreshButton.setText("Refresh"); tableRefreshButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); tableRefreshButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); try { dialog.run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { monitor.beginTask("Refreshing tables...", 21); refreshTables(monitor); } catch (Exception e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }); } catch (Exception exc) { } } }); selectAllButton = new Button(buttonContainer, SWT.PUSH); selectAllButton.setText("Select All"); selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); selectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { for (int i = 0; i < table.getItemCount(); i++) { table.getItem(i).setChecked(true); } dialogChanged(); } catch (Exception exc) { } } }); selectNoneButton = new Button(buttonContainer, SWT.PUSH); selectNoneButton.setText("Select None"); selectNoneButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); selectNoneButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { for (int i = 0; i < table.getItemCount(); i++) { table.getItem(i).setChecked(false); } dialogChanged(); } catch (Exception exc) { } } }); label = new Label(container, SWT.NULL); label.setText("&Package:"); packageText = new Text(container, SWT.BORDER | SWT.SINGLE); packageText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); gd = new GridData(); gd.widthHint = 250; packageText.setLayoutData(gd); packageButton = new Button(container, SWT.NATIVE); packageButton.setText("Browse"); packageButton.addMouseListener(new MouseListener() { public void mouseDown(MouseEvent e) { if (null != project) { try { IJavaSearchScope searchScope = SearchEngine.createWorkspaceScope(); SelectionDialog sd = JavaUI.createPackageDialog(getShell(), project, IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS); sd.open(); Object[] objects = sd.getResult(); if (null != objects && objects.length > 0) { IPackageFragment pf = (IPackageFragment) objects[0]; packageText.setText(pf.getElementName()); } } catch (JavaModelException jme) { jme.printStackTrace(); } } } public void mouseDoubleClick(MouseEvent e) { } public void mouseUp(MouseEvent e) { } }); if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() == 1) { Object obj = ssel.getFirstElement(); if (obj instanceof IResource) { IContainer cont; if (obj instanceof IContainer) cont = (IContainer) obj; else cont = ((IResource) obj).getParent(); containerText.setText(cont.getFullPath().toString()); projectChanged(cont.getProject()); } else if (obj instanceof IPackageFragment) { IPackageFragment frag = (IPackageFragment) obj; containerText.setText(frag.getPath().toString()); projectChanged(frag.getJavaProject().getProject()); } else if (obj instanceof IPackageFragmentRoot) { IPackageFragmentRoot root = (IPackageFragmentRoot) obj; containerText.setText(root.getPath().toString()); projectChanged(root.getJavaProject().getProject()); } else if (obj instanceof IJavaProject) { IJavaProject proj = (IJavaProject) obj; containerText.setText("/" + proj.getProject().getName()); projectChanged(proj.getProject()); } else if (obj instanceof IProject) { IProject proj = (IProject) obj; containerText.setText("/" + proj.getName()); projectChanged(proj); } } } containerText.forceFocus(); initialize(); dialogChanged(); return container; }
From source file:com.ibm.domino.osgi.debug.actions.CreateNotesJavaApiProject.java
License:Open Source License
private void doCreateNotesJavaApiProject() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject project = root.getProject(JAVA_API_PROJECT_NAME); if (project.exists()) { boolean bContinue = MessageDialog.openQuestion(window.getShell(), "Debug plug-in for Domino OSGi", MessageFormat.format("Project {0} already exists. Would you like to update it?", JAVA_API_PROJECT_NAME)); if (!bContinue) { return; }//from w w w . jav a2 s . c o m } String binDirectory = Activator.getDefault().getPreferenceStore() .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR); if (binDirectory == null || binDirectory.length() == 0) { int ret = new MessageDialog(window.getShell(), "Question", null, "Domino Bin directory not set, please click on the link to set it", MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { /* * (non-Javadoc) * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createCustomArea(Composite parent) { Link link = new Link(parent, SWT.NONE); link.setFont(parent.getFont()); link.setText("<A>Domino Debug Plugin Preferences....</A>"); link.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { doLinkActivated(); } private void doLinkActivated() { String id = "com.ibm.domino.osgi.debug.preferences.DominoOSGiDebugPreferencePage"; PreferencesUtil .createPreferenceDialogOn(window.getShell(), id, new String[] { id }, null) .open(); } public void widgetDefaultSelected(SelectionEvent e) { doLinkActivated(); } }); return link; } }.open(); if (ret == 1) { return; } } binDirectory = Activator.getDefault().getPreferenceStore() .getString(PreferenceConstants.PREF_DOMINO_BIN_DIR); if (binDirectory == null || binDirectory.length() == 0) { MessageDialog.openError(window.getShell(), "Error", "Domino Bin directory not set"); return; } try { final String sBinDir = binDirectory; new ProgressMonitorDialog(window.getShell()).run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { if (!project.exists()) { project.create(monitor); } project.open(monitor); IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); String[] newNatures = new String[natures.length + 2]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = JavaCore.NATURE_ID; newNatures[natures.length + 1] = "org.eclipse.pde.PluginNature"; description.setNatureIds(newNatures); project.setDescription(description, monitor); //Copy the resources under res copyOneLevel(project, monitor, "res", ""); //Copy notes.jar File notesJar = new File(sBinDir + "/jvm/lib/ext/Notes.jar"); if (!notesJar.exists() || !notesJar.isFile()) { MessageDialog.openError(window.getShell(), "Error", MessageFormat.format("{0} does not exist", notesJar.getAbsolutePath())); return; } copyFile(notesJar, project.getFile("Notes.jar"), monitor); } catch (Throwable t) { throw new InvocationTargetException(t); } } }); } catch (Throwable t) { MessageDialog.openError(window.getShell(), "error", t.getMessage()); t.printStackTrace(); } }