Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 220156
Collapse All | Expand All

(-)ejbcreation/org/eclipse/jst/j2ee/internal/ejb/project/operations/EjbFacetInstallDataModelProvider.java (-13 / +29 lines)
Lines 69-77 Link Here
69
			String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
69
			String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
70
			return projectName + IJ2EEModuleConstants.JAR_EXT; 
70
			return projectName + IJ2EEModuleConstants.JAR_EXT; 
71
		} else if (propertyName.equals(IJ2EEFacetInstallDataModelProperties.GENERATE_DD)) {
71
		} else if (propertyName.equals(IJ2EEFacetInstallDataModelProperties.GENERATE_DD)) {
72
			if (getBooleanProperty(CREATE_CLIENT)) {
73
				return Boolean.TRUE;
74
			}
72
			IProjectFacetVersion facetVersion = (IProjectFacetVersion)getProperty(FACET_VERSION);
75
			IProjectFacetVersion facetVersion = (IProjectFacetVersion)getProperty(FACET_VERSION);
73
			if(facetVersion == EJB_30){
76
			if (facetVersion == EJB_30) {
74
				return Boolean.valueOf(J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(J2EEPreferences.Keys.EJB_GENERATE_DD));
77
				return J2EEPlugin.getDefault().getJ2EEPreferences().getBoolean(J2EEPreferences.Keys.EJB_GENERATE_DD);
75
			}
78
			}
76
			return Boolean.TRUE;
79
			return Boolean.TRUE;
77
		}
80
		}
Lines 88-99 Link Here
88
	}
91
	}
89
		
92
		
90
	public boolean isPropertyEnabled(String propertyName) {
93
	public boolean isPropertyEnabled(String propertyName) {
91
		if ( CLIENT_NAME.equals(propertyName )) {
94
		if (CLIENT_NAME.equals(propertyName)) {
92
			return getBooleanProperty(CREATE_CLIENT);
95
			return getBooleanProperty(CREATE_CLIENT);
93
		}else if( CLIENT_URI.equals(propertyName )){
96
		} else if (CLIENT_URI.equals(propertyName)) {
94
			return getBooleanProperty(CREATE_CLIENT);
97
			return getBooleanProperty(CREATE_CLIENT);
95
		}else if(CREATE_CLIENT.equals(propertyName)){
98
		} else if (CREATE_CLIENT.equals(propertyName)) {
96
			return getBooleanProperty(ADD_TO_EAR);
99
			return getBooleanProperty(ADD_TO_EAR);
100
		} else if (GENERATE_DD.equals(propertyName)) {
101
			return !getBooleanProperty(CREATE_CLIENT);
97
		}
102
		}
98
		return super.isPropertyEnabled(propertyName);
103
		return super.isPropertyEnabled(propertyName);
99
	}
104
	}
Lines 102-124 Link Here
102
	public boolean propertySet(String propertyName, Object propertyValue) {
107
	public boolean propertySet(String propertyName, Object propertyValue) {
103
		boolean status = super.propertySet(propertyName, propertyValue);
108
		boolean status = super.propertySet(propertyName, propertyValue);
104
		
109
		
105
		if (propertyName.equals(CREATE_CLIENT)){
110
		if (propertyName.equals(CREATE_CLIENT)) {
106
	    	model.notifyPropertyChange(CLIENT_NAME, IDataModel.ENABLE_CHG);
111
	    	model.notifyPropertyChange(CLIENT_NAME, IDataModel.ENABLE_CHG);
107
	    	model.notifyPropertyChange(CLIENT_URI, IDataModel.ENABLE_CHG);
112
	    	model.notifyPropertyChange(CLIENT_URI, IDataModel.ENABLE_CHG);
108
	    }else if (propertyName.equals(FACET_PROJECT_NAME)){
113
	    	model.notifyPropertyChange(GENERATE_DD, IDataModel.ENABLE_CHG);
109
	    	model.setStringProperty(CLIENT_NAME, (String)model.getDefaultProperty(CLIENT_NAME));
114
	    	if ((Boolean) propertyValue && isPropertySet(GENERATE_DD)) {
110
	    	model.setStringProperty(CLIENT_URI, (String)model.getDefaultProperty(CLIENT_URI));
115
    			model.setBooleanProperty(GENERATE_DD, true);
111
	    }else if(propertyName.equals(ADD_TO_EAR)){
116
    		} else {
112
	    	boolean addToEar = ((Boolean)propertyValue).booleanValue();
117
    	    	model.notifyPropertyChange(GENERATE_DD, IDataModel.DEFAULT_CHG);
113
	    	if(!addToEar && isPropertySet(CREATE_CLIENT)){
118
    		}
119
	    } else if (propertyName.equals(FACET_PROJECT_NAME)) {
120
	    	model.setStringProperty(CLIENT_NAME, (String) model.getDefaultProperty(CLIENT_NAME));
121
	    	model.setStringProperty(CLIENT_URI, (String) model.getDefaultProperty(CLIENT_URI));
122
	    } else if (propertyName.equals(ADD_TO_EAR)) {
123
	    	boolean addToEar = (Boolean) propertyValue;
124
	    	if (!addToEar && isPropertySet(CREATE_CLIENT)) {
114
	    		model.setBooleanProperty(CREATE_CLIENT, false);
125
	    		model.setBooleanProperty(CREATE_CLIENT, false);
115
	    	} else {
126
	    	} else {
116
	    		model.notifyPropertyChange(CREATE_CLIENT, IDataModel.DEFAULT_CHG);
127
	    		model.notifyPropertyChange(CREATE_CLIENT, IDataModel.DEFAULT_CHG);
117
		    	model.notifyPropertyChange(CLIENT_NAME, IDataModel.ENABLE_CHG);
128
		    	model.notifyPropertyChange(CLIENT_NAME, IDataModel.ENABLE_CHG);
118
		    	model.notifyPropertyChange(CLIENT_URI, IDataModel.ENABLE_CHG);
129
		    	model.notifyPropertyChange(CLIENT_URI, IDataModel.ENABLE_CHG);
130
		    	model.notifyPropertyChange(GENERATE_DD, IDataModel.ENABLE_CHG);
131
		    	if ((Boolean) getProperty(CREATE_CLIENT) && isPropertySet(GENERATE_DD)) {
132
	    			model.setBooleanProperty(GENERATE_DD, true);
133
	    		} else {
134
	    	    	model.notifyPropertyChange(GENERATE_DD, IDataModel.DEFAULT_CHG);
135
	    		}
119
	    	}
136
	    	}
120
	    	model.notifyPropertyChange(CREATE_CLIENT, IDataModel.ENABLE_CHG);
137
	    	model.notifyPropertyChange(CREATE_CLIENT, IDataModel.ENABLE_CHG);
121
122
	    }
138
	    }
123
139
124
		return status;
140
		return status;

Return to bug 220156