| /******************************************************************************* |
| * Copyright (c) 2016 ALL4TEC & CEA LIST. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * ALL4TEC & CEA LIST - initial API and implementation |
| ******************************************************************************/ |
| package org.polarsys.esf.core.ui.wizards.saproject; |
| |
| import org.apache.commons.lang3.StringUtils; |
| import org.eclipse.ui.IWorkingSet; |
| |
| /** |
| * State pattern used with Project creation wizard. |
| * |
| * It contains data / information necessary to create a ESF Project. |
| * |
| * Warning : all fields must be initialised. |
| * |
| * @author $Author: jdumont $ |
| * @version $Revision: 83 $ |
| * |
| */ |
| public class ProjectCreationState { |
| |
| /** Name of model. */ |
| private String mModelName = StringUtils.EMPTY; |
| |
| /** Flag used to detect if default project area creation parameter should be used or not. */ |
| private boolean mUseDefault = false; |
| |
| /** Project name. */ |
| private String mProjectName = StringUtils.EMPTY; |
| |
| /** Project location URI. */ |
| private java.net.URI mLocationURI = null; |
| |
| /** Name of feared events library. */ |
| private String mFearedEventsLibraryName = null; |
| |
| /** Array of working set to which project will be added. */ |
| private IWorkingSet[] mWorkingSetsArray = new IWorkingSet[0]; |
| |
| /** |
| * Default constructor. |
| */ |
| public ProjectCreationState() { |
| } |
| |
| /** |
| * Return the name of the model specified by the user, or the project |
| * name if no specific value has been given. |
| * |
| * The returned value is not filtered and keep all its potential non alpha numeric characters. |
| * |
| * @return The model name to use |
| */ |
| public String getModelName() { |
| // Get the value specified by the user if any |
| String vModelName = mModelName; |
| |
| // If no specific value is given, use the project name directly |
| // NB : Don't filter the non alpha numeric characters |
| if (StringUtils.isBlank(vModelName)) { |
| vModelName = getProjectName(); |
| } |
| |
| return vModelName; |
| } |
| |
| /** |
| * @param pModelName The modelName to set |
| */ |
| public void setModelName(final String pModelName) { |
| mModelName = pModelName; |
| } |
| |
| /** |
| * @return The useDefault |
| */ |
| public boolean isUseDefault() { |
| return mUseDefault; |
| } |
| |
| /** |
| * @param pUseDefault The useDefault to set |
| */ |
| public void setUseDefault(final boolean pUseDefault) { |
| mUseDefault = pUseDefault; |
| } |
| |
| /** |
| * Return the name of the project to create. |
| * |
| * The returned value is not filtered and keep all its potential non alpha numeric characters. |
| * |
| * @return The project name |
| */ |
| public String getProjectName() { |
| return mProjectName; |
| } |
| |
| /** |
| * @param pProjectName The projectName to set |
| */ |
| public void setProjectName(final String pProjectName) { |
| mProjectName = pProjectName; |
| } |
| |
| /** |
| * @return The locationURI |
| */ |
| public java.net.URI getLocationURI() { |
| return mLocationURI; |
| } |
| |
| /** |
| * @param pLocationURI The locationURI to set |
| */ |
| public void setLocationURI(final java.net.URI pLocationURI) { |
| mLocationURI = pLocationURI; |
| } |
| |
| /** |
| * @return The workingSetsArray |
| */ |
| public IWorkingSet[] getWorkingSetsArray() { |
| return mWorkingSetsArray; |
| } |
| |
| /** |
| * @param pWorkingSetsArray The workingSetsArray to set |
| */ |
| public void setWorkingSetsArray(final IWorkingSet[] pWorkingSetsArray) { |
| mWorkingSetsArray = pWorkingSetsArray; |
| } |
| |
| /** |
| * Return the name of the feared events library specified by the user, or the model |
| * name if no specific value has been given. |
| * |
| * The returned value is not filtered and keep all its potential non alpha numeric characters. |
| * |
| * @return The feared events library name to use |
| */ |
| public String getFearedEventsLibraryName() { |
| // Get the value specified by the user if any |
| String vLibraryName = mFearedEventsLibraryName; |
| |
| // If no specific value is given, use the model name directly |
| // NB : Don't filter the non alpha numeric characters |
| if (StringUtils.isBlank(vLibraryName)) { |
| vLibraryName = getModelName(); |
| } |
| |
| return vLibraryName; |
| } |
| |
| /** |
| * @param pFearedEventsLibraryName Name of feared events library |
| */ |
| public void setFearedEventsLibraryName(final String pFearedEventsLibraryName) { |
| mFearedEventsLibraryName = pFearedEventsLibraryName; |
| } |
| |
| } |