List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_LABEL
String NO_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_LABEL.
Click Source Link
From source file:net.tourbook.database.TourDatabase.java
License:Open Source License
/** * this must be implemented or updated when the database version must be updated *//* w w w .j av a2 s . c om*/ private boolean updateDbDesign(final Connection conn, int currentDbVersion, final IProgressMonitor monitor) { /* * confirm update */ // define buttons with default to NO final String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; if ((new MessageDialog(Display.getDefault().getActiveShell(), Messages.Database_Confirm_update_title, null, NLS.bind(Messages.Database_Confirm_update, new Object[] { currentDbVersion, TOURBOOK_DB_VERSION, _databasePath }), MessageDialog.QUESTION, buttons, 1).open()) != Window.OK) { // no update -> close application PlatformUI.getWorkbench().close(); return false; } /* * do an additional check because version 20 is restructuring the data series */ if (currentDbVersion < 20) { if ((new MessageDialog(Display.getDefault().getActiveShell(), Messages.Database_Confirm_update_title, null, NLS.bind(Messages.Database_Confirm_Update20, _databasePath), MessageDialog.QUESTION, buttons, 1).open()) != Window.OK) { // no update -> close application PlatformUI.getWorkbench().close(); return false; } } int newVersion = currentDbVersion; final int oldVersion = currentDbVersion; /* * database update */ try { if (currentDbVersion == 1) { updateDbDesign_001_002(conn); currentDbVersion = newVersion = 2; } if (currentDbVersion == 2) { updateDbDesign_002_003(conn); currentDbVersion = newVersion = 3; } if (currentDbVersion == 3) { updateDbDesign_003_004(conn, monitor); currentDbVersion = newVersion = 4; } boolean isPostUpdate5 = false; if (currentDbVersion == 4) { updateDbDesign_004_005(conn, monitor); currentDbVersion = newVersion = 5; isPostUpdate5 = true; } if (currentDbVersion == 5) { updateDbDesign_005_006(conn, monitor); currentDbVersion = newVersion = 6; } if (currentDbVersion == 6) { updateDbDesign_006_007(conn, monitor); currentDbVersion = newVersion = 7; } if (currentDbVersion == 7) { updateDbDesign_007_008(conn, monitor); currentDbVersion = newVersion = 8; } boolean isPostUpdate9 = false; if (currentDbVersion == 8) { updateDbDesign_008_009(conn, monitor); currentDbVersion = newVersion = 9; isPostUpdate9 = true; } if (currentDbVersion == 9) { updateDbDesign_009_010(conn, monitor); currentDbVersion = newVersion = 10; } boolean isPostUpdate11 = false; if (currentDbVersion == 10) { currentDbVersion = newVersion = updateDbDesign_010_011(conn, monitor); isPostUpdate11 = true; } if (currentDbVersion == 11) { currentDbVersion = newVersion = updateDbDesign_011_012(conn, monitor); } boolean isPostUpdate13 = false; if (currentDbVersion == 12) { currentDbVersion = newVersion = updateDbDesign_012_013(conn, monitor); isPostUpdate13 = true; } if (currentDbVersion == 13) { currentDbVersion = newVersion = updateDbDesign_013_014(conn, monitor); } if (currentDbVersion == 14) { currentDbVersion = newVersion = updateDbDesign_014_015(conn, monitor); } if (currentDbVersion == 15) { currentDbVersion = newVersion = updateDbDesign_015_to_016(conn, monitor); } if (currentDbVersion == 16) { currentDbVersion = newVersion = updateDbDesign_016_to_017(conn, monitor); } if (currentDbVersion == 17) { currentDbVersion = newVersion = updateDbDesign_017_to_018(conn, monitor); } if (currentDbVersion == 18) { currentDbVersion = newVersion = updateDbDesign_018_to_019(conn, monitor); } boolean isPostUpdate20 = false; if (currentDbVersion == 19) { currentDbVersion = newVersion = updateDbDesign_019_to_020(conn, monitor); isPostUpdate20 = true; } /* * 21 */ if (currentDbVersion == 20) { currentDbVersion = newVersion = updateDbDesign_020_to_021(conn, monitor); } /* * 22 */ boolean isPostUpdate22 = false; if (currentDbVersion == 21) { currentDbVersion = newVersion = updateDbDesign_021_to_022(conn, monitor); isPostUpdate22 = true; } /* * 23 */ boolean isPostUpdate23 = false; if (currentDbVersion == 22) { currentDbVersion = newVersion = updateDbDesign_022_to_023(conn, monitor); isPostUpdate23 = true; } /* * 24 */ if (currentDbVersion == 23) { currentDbVersion = newVersion = updateDbDesign_023_to_024(conn, monitor); } /* * 24 -> 25 */ boolean isPostUpdate25 = false; if (currentDbVersion == 24) { isPostUpdate25 = true; currentDbVersion = newVersion = updateDbDesign_024_to_025(conn, monitor); } /* * 25 -> 26 */ if (currentDbVersion == 25) { currentDbVersion = newVersion = updateDbDesign_025_to_026(conn, monitor); } /* * 26 -> 27 */ if (currentDbVersion == 26) { currentDbVersion = newVersion = updateDbDesign_026_to_027(conn, monitor); } /* * 27 -> 28 */ boolean isPostUpdate28 = false; if (currentDbVersion == 27) { isPostUpdate28 = true; currentDbVersion = newVersion = updateDbDesign_027_to_028(conn, monitor); } /* * 28 -> 29 */ boolean isPostUpdate29 = false; if (currentDbVersion == 28) { isPostUpdate29 = true; currentDbVersion = newVersion = updateDbDesign_028_to_029(conn, monitor); } /* * 29 -> 30 */ if (currentDbVersion == 29) { currentDbVersion = newVersion = updateDbDesign_029_to_030(conn, monitor); } /* * 30 -> 31 */ if (currentDbVersion == 30) { currentDbVersion = newVersion = updateDbDesign_030_to_031(conn, monitor); } /* * 31 -> 32 */ boolean isPostUpdate32 = false; if (currentDbVersion == 31) { isPostUpdate32 = true; currentDbVersion = newVersion = updateDbDesign_031_to_032(conn, monitor); } /* * update version number */ updateDbDesign_VersionNumber(conn, newVersion); /** * Do post update after the version number is updated because the post update uses * connections and entitymanager which is checking the version number. * <p> * Also the data structure must be updated otherwise the entity manager fails because * the data structure in the programm code MUST be the same as in the database. */ if (isPostUpdate5) { TourDatabase.computeComputedValuesForAllTours(monitor); TourManager.getInstance().removeAllToursFromCache(); } if (isPostUpdate9) { updateDbDesign_008_009_PostUpdate(conn, monitor); } if (isPostUpdate11) { updateDbDesign_010_011_PostUpdate(conn, monitor); } if (isPostUpdate13) { updateDbDesign_012_013_PostUpdate(conn, monitor); } if (isPostUpdate20) { updateDbDesign_019_to_020_PostUpdate(conn, monitor); } if (isPostUpdate22) { updateDbDesign_021_to_022_PostUpdate(conn, monitor); } if (isPostUpdate23) { updateDbDesign_022_to_023_PostUpdate(conn, monitor); } if (isPostUpdate25) { updateDbDesign_024_to_025_PostUpdate(conn, monitor); } if (isPostUpdate28) { updateDbDesign_027_to_028_PostUpdate(conn, monitor); } if (isPostUpdate29) { updateDbDesign_028_to_029_PostUpdate(conn, monitor); } if (isPostUpdate32) { updateDbDesign_031_to_032_PostUpdate(conn, monitor); } } catch (final SQLException e) { UI.showSQLException(e); _isSQLUpdateError = true; return false; } // display info for the successful update MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.tour_database_version_info_title, NLS.bind(Messages.Tour_Database_UpdateInfo, oldVersion, newVersion)); return true; }
From source file:net.tourbook.importdata.RawDataManager.java
License:Open Source License
private String importRawData_20_CopyFile(final TourbookDevice device, final String sourceFileName, final String destinationPath, final boolean buildNewFileName, final FileCollisionBehavior fileCollision) { String destFileName = new File(sourceFileName).getName(); if (buildNewFileName) { destFileName = null;/*from w w w .j av a 2 s. co m*/ try { destFileName = device.buildFileNameFromRawData(sourceFileName); } catch (final Exception e) { TourLogManager.logEx(e); } finally { if (destFileName == null) { MessageDialog .openError(Display.getDefault().getActiveShell(), Messages.Import_Data_Error_CreatingFileName_Title, NLS.bind(Messages.Import_Data_Error_CreatingFileName_Message, // new Object[] { sourceFileName, new org.eclipse.core.runtime.Path(destinationPath) .addTrailingSeparator().toString(), TEMP_IMPORTED_FILE })); destFileName = TEMP_IMPORTED_FILE; } } } final File newFile = new File( (new org.eclipse.core.runtime.Path(destinationPath).addTrailingSeparator().toString() + destFileName)); // get source file final File fileIn = new File(sourceFileName); // check if file already exist if (newFile.exists()) { // TODO allow user to rename the file boolean keepFile = false; // for MessageDialog result if (fileCollision.value == FileCollisionBehavior.ASK) { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final MessageDialog messageDialog = new MessageDialog(shell, Messages.Import_Wizard_Message_Title, null, NLS.bind(Messages.Import_Wizard_Message_replace_existing_file, newFile), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL }, 0); messageDialog.open(); final int returnCode = messageDialog.getReturnCode(); switch (returnCode) { case 1: // YES_TO_ALL fileCollision.value = FileCollisionBehavior.REPLACE; break; case 3: // NO_TO_ALL fileCollision.value = FileCollisionBehavior.KEEP; case 2: // NO keepFile = true; break; default: break; } } if (fileCollision.value == FileCollisionBehavior.KEEP || keepFile) { _isImportCanceled = true; fileIn.delete(); return null; } } // copy source file into destination file FileInputStream inReader = null; FileOutputStream outReader = null; try { inReader = new FileInputStream(fileIn); outReader = new FileOutputStream(newFile); int c; while ((c = inReader.read()) != -1) { outReader.write(c); } inReader.close(); outReader.close(); } catch (final FileNotFoundException e) { TourLogManager.logEx(e); return null; } catch (final IOException e) { TourLogManager.logEx(e); return null; } finally { // close the files if (inReader != null) { try { inReader.close(); } catch (final IOException e) { TourLogManager.logEx(e); return null; } } if (outReader != null) { try { outReader.close(); } catch (final IOException e) { TourLogManager.logEx(e); return null; } } } // delete source file fileIn.delete(); return newFile.getAbsolutePath(); }
From source file:net.tourbook.preferences.PrefPageTags.java
License:Open Source License
private void onReset() { final MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.pref_tourtag_dlg_reset_title, null, Messages.pref_tourtag_dlg_reset_message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); if (dialog.open() != Window.OK) { setFocusToViewer();// w w w.ja va2s. c o m return; } try { System.out.println("RESET TAG STRUCTURE"); //$NON-NLS-1$ final StringBuilder sb = new StringBuilder(); final Connection conn = TourDatabase.getInstance().getConnection(); /* * remove join table tag->category */ sb.append("DELETE FROM "); //$NON-NLS-1$ sb.append(TourDatabase.JOINTABLE__TOURTAGCATEGORY_TOURTAG); int result = conn.createStatement().executeUpdate(sb.toString()); System.out.println("Deleted " //$NON-NLS-1$ + result + " entries from " //$NON-NLS-1$ + TourDatabase.JOINTABLE__TOURTAGCATEGORY_TOURTAG); /* * remove jointable category<->category */ sb.setLength(0); sb.append("DELETE FROM "); //$NON-NLS-1$ sb.append(TourDatabase.JOINTABLE__TOURTAGCATEGORY_TOURTAGCATEGORY); result = conn.createStatement().executeUpdate(sb.toString()); System.out.println("Deleted " //$NON-NLS-1$ + result + " entries from " //$NON-NLS-1$ + TourDatabase.JOINTABLE__TOURTAGCATEGORY_TOURTAGCATEGORY); /* * set tags to root */ sb.setLength(0); sb.append("UPDATE "); //$NON-NLS-1$ sb.append(TourDatabase.TABLE_TOUR_TAG); sb.append(" SET isRoot=1"); //$NON-NLS-1$ result = conn.createStatement().executeUpdate(sb.toString()); System.out.println("Set " + result + " tour tags to root"); //$NON-NLS-1$ //$NON-NLS-2$ /* * set categories to root */ sb.setLength(0); sb.append("UPDATE "); //$NON-NLS-1$ sb.append(TourDatabase.TABLE_TOUR_TAG_CATEGORY); sb.append(" SET isRoot=1"); //$NON-NLS-1$ result = conn.createStatement().executeUpdate(sb.toString()); System.out.println("Set " + result + " tour categories to root"); //$NON-NLS-1$ //$NON-NLS-2$ conn.close(); // update the tag viewer _rootItem = new TVIPrefTagRoot(_tagViewer); updateTagViewer(); _isModified = true; } catch (final SQLException e) { UI.showSQLException(e); } setFocusToViewer(); }
From source file:net.tourbook.ui.UI.java
License:Open Source License
public static boolean confirmOverwrite(final FileCollisionBehavior fileCollision, final File file) { final boolean[] isOverwrite = { false }; final int fileCollisionValue = fileCollision.value; if (fileCollisionValue == FileCollisionBehavior.REPLACE_ALL) { // overwrite is already confirmed isOverwrite[0] = true;/*from ww w. j av a 2s. c o m*/ } else if (fileCollisionValue == FileCollisionBehavior.ASK || fileCollisionValue == FileCollisionBehavior.REPLACE || fileCollisionValue == FileCollisionBehavior.KEEP) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final MessageDialog dialog = new MessageDialog(// shell, Messages.app_dlg_confirmFileOverwrite_title, null, NLS.bind(Messages.app_dlg_confirmFileOverwrite_message, file.getPath()), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0); dialog.open(); final int returnCode = dialog.getReturnCode(); switch (returnCode) { case -1: // dialog was canceled case 4: fileCollision.value = FileCollisionBehavior.DIALOG_IS_CANCELED; break; case 0: // YES fileCollision.value = FileCollisionBehavior.REPLACE; isOverwrite[0] = true; break; case 1: // YES_TO_ALL fileCollision.value = FileCollisionBehavior.REPLACE_ALL; isOverwrite[0] = true; break; case 2: // NO fileCollision.value = FileCollisionBehavior.KEEP; break; case 3: // NO_TO_ALL fileCollision.value = FileCollisionBehavior.KEEP_ALL; break; default: break; } } }); } return isOverwrite[0]; }
From source file:net.tourbook.ui.views.tourDataEditor.TourDataEditorView.java
License:Open Source License
/** * @return Returns <code>true</code> when the tour should be discarded<br> * returns <code>false</code> when the tour is invalid but should be saved<br> *//* www . j av a2 s . co m*/ private boolean isDiscardTour() { final MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.tour_editor_dlg_save_tour_title, null, NLS.bind(Messages.tour_editor_dlg_save_invalid_tour, TourManager.getTourDateFull(_tourData)), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); final int result = dialog.open(); if (result == 0) { // discard modifications return true; } else { // save modifications return false; } }
From source file:net.tourbook.ui.views.tourDataEditor.TourDataEditorView.java
License:Open Source License
/** * @param isConfirmSave/* w w w. j a va 2 s . c o m*/ * @return Returns <code>true</code> when the tour was saved, <code>false</code> when the tour * is not saved but canceled */ private boolean saveTourConfirmation() { if (_isTourDirty == false) { return true; } // show the tour data editor try { getSite().getPage().showView(ID, null, IWorkbenchPage.VIEW_VISIBLE); } catch (final PartInitException e) { e.printStackTrace(); } // confirm save/discard/cancel final int returnCode = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.tour_editor_dlg_save_tour_title, null, NLS.bind(Messages.tour_editor_dlg_save_tour_message, TourManager.getTourDateFull(_tourData)), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0)// .open(); if (returnCode == 0) { // button YES: save tour saveTourIntoDB(); return true; } else if (returnCode == 1) { // button NO: discard modifications discardModifications(); return true; } else { // button CANCEL / dialog is canceled: tour is not saved and not discarded return false; } }
From source file:net.yatomiya.e4.ui.dialogs.TextMessageDialog.java
License:Open Source License
static String[] getButtonLabels(Type type) { String[] dialogButtonLabels;/* w ww.j a v a2 s .c o m*/ switch (type) { case NONE: case ERROR: case INFORMATION: case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in NMessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
From source file:nexcore.tool.uml.ui.core.registry.ResourceManager.java
License:Open Source License
/** * //w w w. j a va 2 s .c o m * * void */ private void addUMLResourceChangeListener() { UMLResourceChangeManager rcm = UMLResourceChangeManager.getInstance(); rcm.addResourceChangeListener(new UMLResourceChangeAdapter() { public void preProjectClose(IResourceChangeEvent event) { preProjectDelete(event); } public void preProjectDelete(final IResourceChangeEvent event) { // ? Display.getDefault().syncExec(new Runnable() { public void run() { try { ProjectUtil.closeEditor((IProject) event.getResource()); } catch (Exception e) { e.printStackTrace(); } List<Resource> saveableList = hasModifiedResource( new IResource[] { (IProject) event.getResource() }); boolean isSave = false; int choice = IDialogConstants.NO_ID; if (saveableList.size() > 0) { final boolean canCancel = true; String[] buttons; buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; String message = String.format("'%s' has been modified. Save changes?", saveableList.get(0).getURI()); ; MessageDialog dialog = new MessageDialog(getShell(), "Save Resource", null, message, MessageDialog.QUESTION, buttons, 0) { protected int getShellStyle() { return (canCancel ? SWT.CLOSE : SWT.NONE) | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | getDefaultOrientation(); } }; choice = dialog.open(); switch (choice) { case ISaveablePart2.YES: isSave = true; cleanResource(new NullProgressMonitor(), new IResource[] { (IProject) event.getResource() }, isSave); break; case ISaveablePart2.NO: isSave = false; cleanResource(new NullProgressMonitor(), new IResource[] { (IProject) event.getResource() }, isSave); break; case ISaveablePart2.CANCEL: break; default: break; } } else { cleanResource(new NullProgressMonitor(), new IResource[] { (IProject) event.getResource() }, isSave); } ProjectUtil.refreshExplorer(); // IProject[] activeUMLProjects = ProjectUtil.getActiveUMLProjects(); // // for(IProject project : activeUMLProjects) { // try { // project.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor()); // } catch (CoreException e) { // e.printStackTrace(); // } // } } }); } public void projectOpened(IProject[] projects) { if (PROJECT_OPEN_IMPORT) { // import ? ? for (IProject project : projects) { openProject.add(project); } return; } for (IProject project : projects) { if (referencedProject.containsKey(project)) { referencedProject.put(project, Boolean.TRUE); IProject[] refProjects = referencedProject.keySet().toArray(new IProject[0]); boolean isOpened = allOpened(); if (isOpened) { initializeModelingData(refProjects, false); referencedProject.clear(); } return; } } initializeModelingData(projects, false); } public boolean allOpened() { for (Iterator<IProject> iterator = referencedProject.keySet().iterator(); iterator.hasNext();) { IProject project = (IProject) iterator.next(); if (!referencedProject.get(project)) { return false; } } return true; } }); // UMLResourceChangeAdapter listener = new UMLResourceChangeAdapter() { // @Override // public void projectOpened(IProject[] projects) { // for (IProject project : projects) { //// referencedProject.remove(project); // } // } // }; // rcm.addResourceChangeListener(listener); }
From source file:nexcore.tool.uml.ui.project.builder.CleanAction.java
License:Open Source License
/** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) *//*from www . java 2s.co m*/ @SuppressWarnings("unchecked") public void run(final IAction action) { if ((null == selection) || (!(selection instanceof IStructuredSelection))) { return; } final List<IProject> projectList = new ArrayList<IProject>(); for (Iterator iterator = ((IStructuredSelection) selection).iterator(); iterator.hasNext();) { Object obj = (Object) iterator.next(); IProject project = ProjectUtil.findProject(obj); if (ProjectUtil.isActiveUMLProject(project) && !projectList.contains(project)) { projectList.add(project); } } Display.getDefault().syncExec(new Runnable() { public void run() { CommonViewer commonViewer = ViewerRegistry.getViewer(); TreePath[] expanedTreePaths = TreeItemUtil.getExpandTreePaths(commonViewer.getTree()).clone(); List<Resource> saveableList = ResourceManager .hasModifiedResource(projectList.toArray(new IResource[] {})); boolean isSave = false; int choice = IDialogConstants.NO_ID; if (saveableList.size() > 0) { final boolean canCancel = true; String[] buttons; buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; String message = NLS.bind(WorkbenchMessages.EditorManager_saveChangesQuestion, saveableList.get(0).getURI()); MessageDialog dialog = new MessageDialog(ViewerRegistry.getViewer().getTree().getShell(), WorkbenchMessages.Save_Resource, null, message, MessageDialog.QUESTION, buttons, 0) { protected int getShellStyle() { return (canCancel ? SWT.CLOSE : SWT.NONE) | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | getDefaultOrientation(); } }; choice = dialog.open(); switch (choice) { case ISaveablePart2.YES: isSave = true; break; case ISaveablePart2.NO: isSave = false; break; case ISaveablePart2.CANCEL: // return; default: break; } } ResourceManager.cleanResource(new NullProgressMonitor(), projectList.toArray(new IResource[] {}), isSave); cleanTreeNode(projectList); TreeItemUtil.expandTreePath(expanedTreePaths, selection); } private void cleanTreeNode(final List<IProject> projectList) { Map<String, ITreeNode> treeNodes = ProjectRegistry.UMLTreeNodeRegistry.getTreeNodes(); List<Object> removeTarget = new ArrayList<Object>(); for (Iterator<String> iterator = treeNodes.keySet().iterator(); iterator.hasNext();) { String type = (String) iterator.next(); for (IResource resource : projectList) { URI uri = URI.createURI(resource.getFullPath().toString()); if (type.indexOf(uri.toString()) > -1) { removeTarget.add(type); treeNodes.get(type).refresh(); } } } // UMLTreeNodeRegistry.getTreeNodes() ? ? for (Object o : removeTarget) { // ProjectRegistry.UMLTreeNodeRegistry.removeTreeNode(o); } for (IProject project : projectList) { ViewerRegistry.getViewer().refresh(project); } ResourceManager.getInstance().initializeModelingData(projectList.toArray(new IProject[] {}), true); } }); }
From source file:org.activiti.designer.kickstart.eclipse.navigator.handlers.DeleteHandler.java
License:Apache License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { List<CmisObject> selectedObjects = CmisNavigatorSelectionHolder.getInstance().getSelectedObjects(); if (!selectedObjects.isEmpty()) { MessageDialog dialog = new MessageDialog(HandlerUtil.getActiveShellChecked(event), generateDialogTitle(selectedObjects), null, // icon generateDialogMessage(selectedObjects), MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); int result = dialog.open(); if (result == 0) { // 'YES' CmisUtil.deleteCmisObjects(selectedObjects); Tree tree = getTreeView(event); TreeItem[] treeItems = tree.getSelection(); for (TreeItem treeItem : treeItems) { treeItem.dispose();// www . ja va 2 s . c om } } } return this; }