/* (non-Javadoc) * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage() */ @Override public boolean canFlipToNextPage() { return (currentStatus == STATUS_OK && (this.getSelectedBuilder() != null) && (!CoreStringUtil.isEmpty(getContainerName())) && (getFileName().length() > 0)); }
private void configureProject(IProject newProject) { try { final IProjectDescription desc = newProject.getDescription(); desc.setNatureIds(new String[0]); newProject.setDescription(desc, null); desc.setNatureIds(MODEL_NATURES); if (ProductCustomizerMgr.getInstance() != null) { String productName = ProductCustomizerMgr.getInstance().getProductName(); if (!CoreStringUtil.isEmpty(productName)) { desc.setComment(productName + ", version " + ModelerCore.ILicense.VERSION); // $NON-NLS-1$ } } newProject.setDescription(desc, null); if (!ProductCustomizerMgr.getInstance() .getProductCharacteristics() .isHiddenProjectCentric()) { // Defect 11480 - closing and opening the project sets the overlay icon properly newProject.close(null); } newProject.open(null); } catch (final CoreException err) { UiConstants.Util.log(IStatus.ERROR, err, err.getMessage()); } }
private boolean checkStatus() { String container = getContainerName(); if (CoreStringUtil.isEmpty(container)) { currentStatus = STATUS_NO_LOCATION; return false; } IProject project = getTargetProject(); if (project == null) { currentStatus = STATUS_NO_LOCATION; return false; } else if (!project.isOpen()) { currentStatus = STATUS_CLOSED_PROJECT; return false; } else { try { if (project.getNature(PluginConstants.MODEL_PROJECT_NATURE_ID) == null) { currentStatus = STATUS_NO_PROJECT_NATURE; return false; } } catch (CoreException ex) { currentStatus = STATUS_NO_PROJECT_NATURE; return false; } } String fileText = getFileText(); if (fileText.length() == 0) { currentStatus = STATUS_NO_FILENAME; return false; } fileNameMessage = ModelUtilities.validateModelName(fileText, fileExtension); if (fileNameMessage != null) { currentStatus = STATUS_BAD_FILENAME; return false; } String fileName = getFileName(); filePath = new Path(container).append(fileName); if (ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { currentStatus = STATUS_FILE_EXISTS; return false; } if (metamodelCombo.getSelectionIndex() < 1) { currentStatus = STATUS_NO_METAMODEL; return false; } if (modelTypesCombo.getSelectionIndex() < 1) { currentStatus = STATUS_NO_TYPE; return false; } if (metamodelCombo.getSelectionIndex() == 6) { // WARN USER OF EXTENSION MODEL DEPRECATION currentStatus = STATUS_DEPRECATED_EXTENSION_METAMODEL; return true; } currentStatus = STATUS_OK; return true; }
public IProject getTargetProject() { IProject result = null; String containerName = getContainerName(); if (!CoreStringUtil.isEmpty(containerName)) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = root.findMember(new Path(containerName)); if (resource.exists()) { result = resource.getProject(); } } return result; }