Code Duplication    Length = 104-116 lines in 9 locations

plugins/DataCube/src/main/java/br/ufrj/ppgi/greco/kettle/DataCubeStepDialog.java 1 location

@@ 178-293 (lines=116) @@
175
176
	}
177
178
	@Override
179
	public String open() {
180
181
		Shell parent = getParent();
182
		Display display = parent.getDisplay();
183
184
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
185
		props.setLook(shell);
186
		setShellImage(shell, input);
187
188
		// ModifyListener padrao
189
		ModifyListener lsMod = new ModifyListener() {
190
191
			@Override
192
			public void modifyText(ModifyEvent e) {
193
				input.setChanged();
194
			}
195
		};
196
		boolean changed = input.hasChanged();
197
198
		FormLayout formLayout = new FormLayout();
199
		formLayout.marginWidth = Const.FORM_MARGIN;
200
		formLayout.marginHeight = Const.FORM_MARGIN;
201
202
		shell.setLayout(formLayout);
203
204
		shell.setText(dialogTitle);
205
206
		int middle = props.getMiddlePct();
207
		int margin = Const.MARGIN;
208
209
		// Adiciona um label e um input text no topo do dialog shell
210
		wlStepname = new Label(shell, SWT.RIGHT);
211
		wlStepname.setText(BaseMessages.getString(PKG, "DataCubeStep.StepNameField.Label"));
212
		props.setLook(wlStepname);
213
214
		fdlStepname = new FormData();
215
		fdlStepname.left = new FormAttachment(0, 0);
216
		fdlStepname.right = new FormAttachment(middle, -margin);
217
		fdlStepname.top = new FormAttachment(0, margin);
218
		wlStepname.setLayoutData(fdlStepname);
219
220
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
221
		wStepname.setText(stepname);
222
		props.setLook(wStepname);
223
224
		wStepname.addModifyListener(lsMod);
225
		fdStepname = new FormData();
226
		fdStepname.left = new FormAttachment(middle, 0);
227
		fdStepname.top = new FormAttachment(0, margin);
228
		fdStepname.right = new FormAttachment(100, 0);
229
		wStepname.setLayoutData(fdStepname);
230
		Control lastControl = wStepname;
231
232
		// Chama metodo que adiciona os widgets especificos da janela
233
		lastControl = buildContents(lastControl, lsMod);
234
235
		// Bottom buttons
236
		wOK = new Button(shell, SWT.PUSH);
237
		wOK.setText(BaseMessages.getString(PKG, "DataCubeStep.Btn.OK")); //$NON-NLS-1$
238
		wCancel = new Button(shell, SWT.PUSH);
239
		wCancel.setText(BaseMessages.getString(PKG, "DataCubeStep.Btn.Cancel")); //$NON-NLS-1$
240
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
241
242
		// Add listeners
243
		lsCancel = new Listener() {
244
			public void handleEvent(Event e) {
245
				cancel();
246
			}
247
		};
248
		lsOK = new Listener() {
249
			public void handleEvent(Event e) {
250
				ok();
251
			}
252
		};
253
254
		wCancel.addListener(SWT.Selection, lsCancel);
255
		wOK.addListener(SWT.Selection, lsOK);
256
257
		// It closes the window affirmatively when the user press enter in one
258
		// of the text input fields
259
		lsDef = new SelectionAdapter() {
260
			public void widgetDefaultSelected(SelectionEvent e) {
261
				ok();
262
			}
263
		};
264
265
		wStepname.addSelectionListener(lsDef);
266
		addSelectionListenerToControls(lsDef);
267
268
		// Detect X or ALT-F4 or something that kills this window...
269
		shell.addShellListener(new ShellAdapter() {
270
			public void shellClosed(ShellEvent e) {
271
				cancel();
272
			}
273
		});
274
275
		// Populate the data of the controls
276
		getData();
277
278
		// Set the shell size, based upon previous time...
279
		setSize();
280
281
		// Alarga um pouco mais a janela
282
		Rectangle shellBounds = shell.getBounds();
283
		shellBounds.width += 5;
284
		shell.setBounds(shellBounds);
285
286
		input.setChanged(changed);
287
288
		shell.open();
289
		while (!shell.isDisposed()) {
290
			if (!display.readAndDispatch())
291
				display.sleep();
292
		}
293
		return stepname;
294
	}
295
296
	private void getData() {

plugins/TurtleGenerator/src/main/java/br/ufrj/ppgi/greco/kettle/TurtleGeneratorStepDialog.java 1 location

@@ 191-305 (lines=115) @@
188
		unity.addSelectionListener(lsDef);
189
	}
190
191
	@Override
192
	public String open() {
193
194
		Shell parent = getParent();
195
		Display display = parent.getDisplay();
196
197
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
198
		props.setLook(shell);
199
		setShellImage(shell, input);
200
201
		// ModifyListener padrao
202
		ModifyListener lsMod = new ModifyListener() {
203
204
			@Override
205
			public void modifyText(ModifyEvent e) {
206
				input.setChanged();
207
			}
208
		};
209
		boolean changed = input.hasChanged();
210
211
		FormLayout formLayout = new FormLayout();
212
		formLayout.marginWidth = Const.FORM_MARGIN;
213
		formLayout.marginHeight = Const.FORM_MARGIN;
214
215
		shell.setLayout(formLayout);
216
217
		shell.setText(dialogTitle);
218
219
		int middle = props.getMiddlePct();
220
		int margin = Const.MARGIN;
221
222
		// Adiciona um label e um input text no topo do dialog shell
223
		wlStepname = new Label(shell, SWT.RIGHT);
224
		wlStepname.setText(BaseMessages.getString(PKG, "TurtleGeneratorStep.StepNameField.Label"));
225
		props.setLook(wlStepname);
226
227
		fdlStepname = new FormData();
228
		fdlStepname.left = new FormAttachment(0, 0);
229
		fdlStepname.right = new FormAttachment(middle, -margin);
230
		fdlStepname.top = new FormAttachment(0, margin);
231
		wlStepname.setLayoutData(fdlStepname);
232
233
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
234
		wStepname.setText(stepname);
235
		props.setLook(wStepname);
236
237
		wStepname.addModifyListener(lsMod);
238
		fdStepname = new FormData();
239
		fdStepname.left = new FormAttachment(middle, 0);
240
		fdStepname.top = new FormAttachment(0, margin);
241
		fdStepname.right = new FormAttachment(100, 0);
242
		wStepname.setLayoutData(fdStepname);
243
		Control lastControl = wStepname;
244
245
		// Chama metodo que adiciona os widgets especificos da janela
246
		lastControl = buildContents(lastControl, lsMod);
247
248
		// Bottom buttons
249
		wOK = new Button(shell, SWT.PUSH);
250
		wOK.setText(BaseMessages.getString(PKG, "TurtleGeneratorStep.Btn.OK")); //$NON-NLS-1$
251
		wCancel = new Button(shell, SWT.PUSH);
252
		wCancel.setText(BaseMessages.getString(PKG, "TurtleGeneratorStep.Btn.Cancel")); //$NON-NLS-1$
253
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
254
255
		// Add listeners
256
		lsCancel = new Listener() {
257
			public void handleEvent(Event e) {
258
				cancel();
259
			}
260
		};
261
		lsOK = new Listener() {
262
			public void handleEvent(Event e) {
263
				ok();
264
			}
265
		};
266
267
		wCancel.addListener(SWT.Selection, lsCancel);
268
		wOK.addListener(SWT.Selection, lsOK);
269
270
		// It closes the window affirmatively when the user press enter in one
271
		// of the text input fields
272
		lsDef = new SelectionAdapter() {
273
			public void widgetDefaultSelected(SelectionEvent e) {
274
				ok();
275
			}
276
		};
277
		wStepname.addSelectionListener(lsDef);
278
		addSelectionListenerToControls(lsDef);
279
280
		// Detect X or ALT-F4 or something that kills this window...
281
		shell.addShellListener(new ShellAdapter() {
282
			public void shellClosed(ShellEvent e) {
283
				cancel();
284
			}
285
		});
286
287
		// Populate the data of the controls
288
		getData();
289
290
		// Set the shell size, based upon previous time...
291
		setSize();
292
293
		// Alarga um pouco mais a janela
294
		Rectangle shellBounds = shell.getBounds();
295
		shellBounds.width += 5;
296
		shell.setBounds(shellBounds);
297
298
		input.setChanged(changed);
299
300
		shell.open();
301
		while (!shell.isDisposed()) {
302
			if (!display.readAndDispatch())
303
				display.sleep();
304
		}
305
		return stepname;
306
	}
307
308
	private void getData() {

plugins/ntriplegenerator/src/main/java/br/ufrj/ppgi/greco/kettle/NTripleGeneratorStepDialog.java 1 location

@@ 130-242 (lines=113) @@
127
		wOutputNTriple.addSelectionListener(lsDef);
128
	}
129
130
	public String open() {
131
132
		Shell parent = getParent();
133
		Display display = parent.getDisplay();
134
135
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
136
		props.setLook(shell);
137
		setShellImage(shell, input);
138
139
		// ModifyListener padrao
140
		ModifyListener lsMod = new ModifyListener() {
141
142
			public void modifyText(ModifyEvent e) {
143
				input.setChanged();
144
			}
145
		};
146
		boolean changed = input.hasChanged();
147
148
		FormLayout formLayout = new FormLayout();
149
		formLayout.marginWidth = Const.FORM_MARGIN;
150
		formLayout.marginHeight = Const.FORM_MARGIN;
151
152
		shell.setLayout(formLayout);
153
154
		shell.setText(dialogTitle);
155
156
		int middle = props.getMiddlePct();
157
		int margin = Const.MARGIN;
158
159
		// Adiciona um label e um input text no topo do dialog shell
160
		wlStepname = new Label(shell, SWT.RIGHT);
161
		wlStepname.setText(BaseMessages.getString(PKG, "NTripleGeneratorStep.StepNameField.Label"));
162
		props.setLook(wlStepname);
163
164
		fdlStepname = new FormData();
165
		fdlStepname.left = new FormAttachment(0, 0);
166
		fdlStepname.right = new FormAttachment(middle, -margin);
167
		fdlStepname.top = new FormAttachment(0, margin);
168
		wlStepname.setLayoutData(fdlStepname);
169
170
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
171
		wStepname.setText(stepname);
172
		props.setLook(wStepname);
173
174
		wStepname.addModifyListener(lsMod);
175
		fdStepname = new FormData();
176
		fdStepname.left = new FormAttachment(middle, 0);
177
		fdStepname.top = new FormAttachment(0, margin);
178
		fdStepname.right = new FormAttachment(100, 0);
179
		wStepname.setLayoutData(fdStepname);
180
		Control lastControl = wStepname;
181
182
		// Chama metodo que adiciona os widgets especificos da janela
183
		lastControl = buildContents(lastControl, lsMod);
184
185
		// Bottom buttons
186
		wOK = new Button(shell, SWT.PUSH);
187
		wOK.setText(BaseMessages.getString(PKG, "NTripleGeneratorStep.Btn.OK"));
188
		wCancel = new Button(shell, SWT.PUSH);
189
		wCancel.setText(BaseMessages.getString(PKG, "NTripleGeneratorStep.Btn.Cancel"));
190
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
191
192
		// Add listeners
193
		lsCancel = new Listener() {
194
			public void handleEvent(Event e) {
195
				cancel();
196
			}
197
		};
198
		lsOK = new Listener() {
199
			public void handleEvent(Event e) {
200
				ok();
201
			}
202
		};
203
204
		wCancel.addListener(SWT.Selection, lsCancel);
205
		wOK.addListener(SWT.Selection, lsOK);
206
207
		// It closes the window affirmatively when the user press enter in one
208
		// of the text input fields
209
		lsDef = new SelectionAdapter() {
210
			public void widgetDefaultSelected(SelectionEvent e) {
211
				ok();
212
			}
213
		};
214
		wStepname.addSelectionListener(lsDef);
215
		addSelectionListenerToControls(lsDef);
216
217
		// Detect X or ALT-F4 or something that kills this window...
218
		shell.addShellListener(new ShellAdapter() {
219
			public void shellClosed(ShellEvent e) {
220
				cancel();
221
			}
222
		});
223
224
		// Populate the data of the controls
225
		getData();
226
227
		// Set the shell size, based upon previous time...
228
		setSize();
229
230
		// Alarga um pouco mais a janela
231
		Rectangle shellBounds = shell.getBounds();
232
		shellBounds.width += 5;
233
		shell.setBounds(shellBounds);
234
235
		input.setChanged(changed);
236
237
		shell.open();
238
		while (!shell.isDisposed()) {
239
			if (!display.readAndDispatch())
240
				display.sleep();
241
		}
242
		return stepname;
243
	}
244
245
	private void getData() {

plugins/GraphTriplify/src/main/java/br/ufrj/ppgi/greco/kettle/GraphTriplifyStepDialog.java 1 location

@@ 97-208 (lines=112) @@
94
		return wOutputGroup;
95
	}
96
97
	public String open() {
98
99
		Shell parent = getParent();
100
		Display display = parent.getDisplay();
101
102
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
103
		props.setLook(shell);
104
		setShellImage(shell, input);
105
106
		// ModifyListener padrao
107
		ModifyListener lsMod = new ModifyListener() {
108
			public void modifyText(ModifyEvent e) {
109
				input.setChanged();
110
			}
111
		};
112
		boolean changed = input.hasChanged();
113
114
		FormLayout formLayout = new FormLayout();
115
		formLayout.marginWidth = Const.FORM_MARGIN;
116
		formLayout.marginHeight = Const.FORM_MARGIN;
117
118
		shell.setLayout(formLayout);
119
120
		shell.setText(dialogTitle);
121
122
		int middle = props.getMiddlePct();
123
		int margin = Const.MARGIN;
124
125
		// Adiciona um label e um input text no topo do dialog shell
126
		wlStepname = new Label(shell, SWT.RIGHT);
127
		wlStepname.setText(BaseMessages.getString(PKG, "GraphTriplifyStep.StepNameField.Label"));
128
		props.setLook(wlStepname);
129
130
		fdlStepname = new FormData();
131
		fdlStepname.left = new FormAttachment(0, 0);
132
		fdlStepname.right = new FormAttachment(middle, -margin);
133
		fdlStepname.top = new FormAttachment(0, margin);
134
		wlStepname.setLayoutData(fdlStepname);
135
136
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
137
		wStepname.setText(stepname);
138
		props.setLook(wStepname);
139
140
		wStepname.addModifyListener(lsMod);
141
		fdStepname = new FormData();
142
		fdStepname.left = new FormAttachment(middle, 0);
143
		fdStepname.top = new FormAttachment(0, margin);
144
		fdStepname.right = new FormAttachment(100, 0);
145
		wStepname.setLayoutData(fdStepname);
146
		Control lastControl = wStepname;
147
148
		// Chama metodo que adiciona os widgets especificos da janela
149
		lastControl = buildContents(lastControl, lsMod);
150
151
		// Bottom buttons
152
		wOK = new Button(shell, SWT.PUSH);
153
		wOK.setText(BaseMessages.getString(PKG, "GraphTriplifyStep.Btn.OK")); //$NON-NLS-1$
154
		wCancel = new Button(shell, SWT.PUSH);
155
		wCancel.setText(BaseMessages.getString(PKG, "GraphTriplifyStep.Btn.Cancel")); //$NON-NLS-1$
156
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
157
158
		// Add listeners
159
		lsCancel = new Listener() {
160
			public void handleEvent(Event e) {
161
				cancel();
162
			}
163
		};
164
		lsOK = new Listener() {
165
			public void handleEvent(Event e) {
166
				ok();
167
			}
168
		};
169
170
		wCancel.addListener(SWT.Selection, lsCancel);
171
		wOK.addListener(SWT.Selection, lsOK);
172
173
		// It closes the window affirmatively when the user press enter in one
174
		// of the text input fields
175
		lsDef = new SelectionAdapter() {
176
			public void widgetDefaultSelected(SelectionEvent e) {
177
				ok();
178
			}
179
		};
180
		wStepname.addSelectionListener(lsDef);
181
		addSelectionListenerToControls(lsDef);
182
183
		// Detect X or ALT-F4 or something that kills this window...
184
		shell.addShellListener(new ShellAdapter() {
185
			public void shellClosed(ShellEvent e) {
186
				cancel();
187
			}
188
		});
189
190
		// Populate the data of the controls
191
		getData();
192
193
		// Set the shell size, based upon previous time...
194
		setSize();
195
196
		// Alarga um pouco mais a janela
197
		Rectangle shellBounds = shell.getBounds();
198
		shellBounds.width += 5;
199
		shell.setBounds(shellBounds);
200
201
		input.setChanged(changed);
202
203
		shell.open();
204
		while (!shell.isDisposed()) {
205
			if (!display.readAndDispatch())
206
				display.sleep();
207
		}
208
		return stepname;
209
	}
210
211
	private void addSelectionListenerToControls(SelectionAdapter lsDef) {

plugins/DataPropertyMapping/src/main/java/br/ufrj/ppgi/greco/kettle/DataPropertyMappingStepDialog.java 1 location

@@ 229-336 (lines=108) @@
226
		wLangTagOutputFieldName.addSelectionListener(lsDef);
227
	}
228
229
	public String open() {
230
231
		Shell parent = getParent();
232
		Display display = parent.getDisplay();
233
234
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
235
		props.setLook(shell);
236
		setShellImage(shell, input);
237
238
		// ModifyListener padrao
239
		ModifyListener lsMod = new ModifyListener() {
240
241
			public void modifyText(ModifyEvent e) {
242
				input.setChanged();
243
			}
244
		};
245
246
		boolean changed = input.hasChanged();
247
248
		FormLayout formLayout = new FormLayout();
249
		formLayout.marginWidth = Const.FORM_MARGIN;
250
		formLayout.marginHeight = Const.FORM_MARGIN;
251
252
		shell.setLayout(formLayout);
253
254
		shell.setText(dialogTitle);
255
256
		int middle = props.getMiddlePct();
257
		int margin = Const.MARGIN;
258
259
		// Adiciona um label e um input text no topo do dialog shell
260
		wlStepname = new Label(shell, SWT.RIGHT);
261
		wlStepname.setText(BaseMessages.getString(PKG, "DataPropertyMappingStep.StepNameField.Label"));
262
		props.setLook(wlStepname);
263
264
		fdlStepname = new FormData();
265
		fdlStepname.left = new FormAttachment(0, 0);
266
		fdlStepname.right = new FormAttachment(middle, -margin);
267
		fdlStepname.top = new FormAttachment(0, margin);
268
		wlStepname.setLayoutData(fdlStepname);
269
270
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
271
		wStepname.setText(stepname);
272
		props.setLook(wStepname);
273
274
		wStepname.addModifyListener(lsMod);
275
		fdStepname = new FormData();
276
		fdStepname.left = new FormAttachment(middle, 0);
277
		fdStepname.top = new FormAttachment(0, margin);
278
		fdStepname.right = new FormAttachment(100, 0);
279
		wStepname.setLayoutData(fdStepname);
280
		Control lastControl = wStepname;
281
282
		lastControl = buildContents(lastControl, lsMod);
283
284
		// Bottom buttons
285
		wOK = new Button(shell, SWT.PUSH);
286
		wOK.setText(BaseMessages.getString(PKG, "DataPropertyMappingStep.Btn.OK"));
287
		wCancel = new Button(shell, SWT.PUSH);
288
		wCancel.setText(BaseMessages.getString(PKG, "DataPropertyMappingStep.Btn.Cancel"));
289
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
290
291
		// Add listeners
292
		lsCancel = new Listener() {
293
			public void handleEvent(Event e) {
294
				cancel();
295
			}
296
		};
297
		lsOK = new Listener() {
298
			public void handleEvent(Event e) {
299
				ok();
300
			}
301
		};
302
303
		wCancel.addListener(SWT.Selection, lsCancel);
304
		wOK.addListener(SWT.Selection, lsOK);
305
306
		// It closes the window affirmatively when the user press enter in one
307
		// of the text input fields
308
		lsDef = new SelectionAdapter() {
309
			public void widgetDefaultSelected(SelectionEvent e) {
310
				ok();
311
			}
312
		};
313
		wStepname.addSelectionListener(lsDef);
314
		addSelectionListenerToControls(lsDef);
315
316
		// Detect X or ALT-F4 or something that kills this window...
317
		shell.addShellListener(new ShellAdapter() {
318
			public void shellClosed(ShellEvent e) {
319
				cancel();
320
			}
321
		});
322
323
		// Populate the data of the controls
324
		getData();
325
326
		// Set the shell size, based upon previous time...
327
		setSize();
328
329
		input.setChanged(changed);
330
331
		shell.open();
332
		while (!shell.isDisposed()) {
333
			if (!display.readAndDispatch())
334
				display.sleep();
335
		}
336
		return stepname;
337
	}
338
339
	private void getData() {

plugins/SparqlEndpoint/src/main/java/br/ufrj/ppgi/greco/kettle/SparqlStepDialog.java 1 location

@@ 224-331 (lines=108) @@
221
		wPrefixVar.addSelectionListener(lsDef);
222
	}
223
224
	public String open() {
225
226
		Shell parent = getParent();
227
		Display display = parent.getDisplay();
228
229
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
230
		props.setLook(shell);
231
		setShellImage(shell, input);
232
233
		// ModifyListener padrao
234
		ModifyListener lsMod = new ModifyListener() {
235
236
			public void modifyText(ModifyEvent e) {
237
				input.setChanged();
238
			}
239
		};
240
		boolean changed = input.hasChanged();
241
242
		FormLayout formLayout = new FormLayout();
243
		formLayout.marginWidth = Const.FORM_MARGIN;
244
		formLayout.marginHeight = Const.FORM_MARGIN;
245
246
		shell.setLayout(formLayout);
247
248
		shell.setText(dialogTitle);
249
250
		int middle = props.getMiddlePct();
251
		int margin = Const.MARGIN;
252
253
		// Adiciona um label e um input text no topo do dialog shell
254
		wlStepname = new Label(shell, SWT.RIGHT);
255
		wlStepname.setText(BaseMessages.getString(PKG, "SparqlStep.StepNameField.Label"));
256
		props.setLook(wlStepname);
257
258
		fdlStepname = new FormData();
259
		fdlStepname.left = new FormAttachment(0, 0);
260
		fdlStepname.right = new FormAttachment(middle, -margin);
261
		fdlStepname.top = new FormAttachment(0, margin);
262
		wlStepname.setLayoutData(fdlStepname);
263
264
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
265
		wStepname.setText(stepname);
266
		props.setLook(wStepname);
267
268
		wStepname.addModifyListener(lsMod);
269
		fdStepname = new FormData();
270
		fdStepname.left = new FormAttachment(middle, 0);
271
		fdStepname.top = new FormAttachment(0, margin);
272
		fdStepname.right = new FormAttachment(100, 0);
273
		wStepname.setLayoutData(fdStepname);
274
		Control lastControl = wStepname;
275
276
		// Chama metodo que adiciona os widgets especificos da janela
277
		lastControl = buildContents(lastControl, lsMod);
278
279
		// Bottom buttons
280
		wOK = new Button(shell, SWT.PUSH);
281
		wOK.setText(BaseMessages.getString(PKG, "SparqlStep.Btn.OK")); //$NON-NLS-1$
282
		wCancel = new Button(shell, SWT.PUSH);
283
		wCancel.setText(BaseMessages.getString(PKG, "SparqlStep.Btn.Cancel")); //$NON-NLS-1$
284
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
285
286
		// Add listeners
287
		lsCancel = new Listener() {
288
			public void handleEvent(Event e) {
289
				cancel();
290
			}
291
		};
292
		lsOK = new Listener() {
293
			public void handleEvent(Event e) {
294
				ok();
295
			}
296
		};
297
298
		wCancel.addListener(SWT.Selection, lsCancel);
299
		wOK.addListener(SWT.Selection, lsOK);
300
301
		// It closes the window affirmatively when the user press enter in one
302
		// of the text input fields
303
		lsDef = new SelectionAdapter() {
304
			public void widgetDefaultSelected(SelectionEvent e) {
305
				ok();
306
			}
307
		};
308
		wStepname.addSelectionListener(lsDef);
309
		addSelectionListenerToControls(lsDef);
310
311
		// Detect X or ALT-F4 or something that kills this window...
312
		shell.addShellListener(new ShellAdapter() {
313
			public void shellClosed(ShellEvent e) {
314
				cancel();
315
			}
316
		});
317
318
		// Populate the data of the controls
319
		getData();
320
321
		// Set the shell size, based upon previous time...
322
		setSize();
323
324
		input.setChanged(changed);
325
326
		shell.open();
327
		while (!shell.isDisposed()) {
328
			if (!display.readAndDispatch())
329
				display.sleep();
330
		}
331
		return stepname;
332
	}
333
334
	private void getData() {

plugins/GraphSparqlEndpoint/src/main/java/br/ufrj/ppgi/greco/kettle/GraphSparqlStepDialog.java 1 location

@@ 188-295 (lines=108) @@
185
		wDefaultGraph.addSelectionListener(lsDef);
186
	}
187
188
	public String open() {
189
190
		Shell parent = getParent();
191
		Display display = parent.getDisplay();
192
193
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
194
		props.setLook(shell);
195
		setShellImage(shell, input);
196
197
		// ModifyListener padrao
198
		ModifyListener lsMod = new ModifyListener() {
199
200
			public void modifyText(ModifyEvent e) {
201
				input.setChanged();
202
			}
203
		};
204
		boolean changed = input.hasChanged();
205
206
		FormLayout formLayout = new FormLayout();
207
		formLayout.marginWidth = Const.FORM_MARGIN;
208
		formLayout.marginHeight = Const.FORM_MARGIN;
209
210
		shell.setLayout(formLayout);
211
212
		shell.setText(dialogTitle);
213
214
		int middle = props.getMiddlePct();
215
		int margin = Const.MARGIN;
216
217
		// Adiciona um label e um input text no topo do dialog shell
218
		wlStepname = new Label(shell, SWT.RIGHT);
219
		wlStepname.setText(BaseMessages.getString(PKG, "GraphSparqlStep.StepNameField.Label"));
220
		props.setLook(wlStepname);
221
222
		fdlStepname = new FormData();
223
		fdlStepname.left = new FormAttachment(0, 0);
224
		fdlStepname.right = new FormAttachment(middle, -margin);
225
		fdlStepname.top = new FormAttachment(0, margin);
226
		wlStepname.setLayoutData(fdlStepname);
227
228
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
229
		wStepname.setText(stepname);
230
		props.setLook(wStepname);
231
232
		wStepname.addModifyListener(lsMod);
233
		fdStepname = new FormData();
234
		fdStepname.left = new FormAttachment(middle, 0);
235
		fdStepname.top = new FormAttachment(0, margin);
236
		fdStepname.right = new FormAttachment(100, 0);
237
		wStepname.setLayoutData(fdStepname);
238
		Control lastControl = wStepname;
239
240
		// Chama metodo que adiciona os widgets especificos da janela
241
		lastControl = buildContents(lastControl, lsMod);
242
243
		// Bottom buttons
244
		wOK = new Button(shell, SWT.PUSH);
245
		wOK.setText(BaseMessages.getString(PKG, "GraphSparqlStep.Btn.OK")); //$NON-NLS-1$
246
		wCancel = new Button(shell, SWT.PUSH);
247
		wCancel.setText(BaseMessages.getString(PKG, "GraphSparqlStep.Btn.Cancel")); //$NON-NLS-1$
248
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
249
250
		// Add listeners
251
		lsCancel = new Listener() {
252
			public void handleEvent(Event e) {
253
				cancel();
254
			}
255
		};
256
		lsOK = new Listener() {
257
			public void handleEvent(Event e) {
258
				ok();
259
			}
260
		};
261
262
		wCancel.addListener(SWT.Selection, lsCancel);
263
		wOK.addListener(SWT.Selection, lsOK);
264
265
		// It closes the window affirmatively when the user press enter in one
266
		// of the text input fields
267
		lsDef = new SelectionAdapter() {
268
			public void widgetDefaultSelected(SelectionEvent e) {
269
				ok();
270
			}
271
		};
272
		wStepname.addSelectionListener(lsDef);
273
		addSelectionListenerToControls(lsDef);
274
275
		// Detect X or ALT-F4 or something that kills this window...
276
		shell.addShellListener(new ShellAdapter() {
277
			public void shellClosed(ShellEvent e) {
278
				cancel();
279
			}
280
		});
281
282
		// Populate the data of the controls
283
		getData();
284
285
		// Set the shell size, based upon previous time...
286
		setSize();
287
288
		input.setChanged(changed);
289
290
		shell.open();
291
		while (!shell.isDisposed()) {
292
			if (!display.readAndDispatch())
293
				display.sleep();
294
		}
295
		return stepname;
296
	}
297
298
	private void getData() {

plugins/ObjectPropertyMapping/src/main/java/br/ufrj/ppgi/greco/kettle/ObjectPropertyMappingStepDialog.java 1 location

@@ 157-264 (lines=108) @@
154
		wObjectOutputFieldName.addSelectionListener(lsDef);
155
	}
156
157
	public String open() {
158
159
		Shell parent = getParent();
160
		Display display = parent.getDisplay();
161
162
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
163
		props.setLook(shell);
164
		setShellImage(shell, input);
165
166
		// ModifyListener padrao
167
		ModifyListener lsMod = new ModifyListener() {
168
169
			public void modifyText(ModifyEvent e) {
170
				input.setChanged();
171
			}
172
		};
173
		boolean changed = input.hasChanged();
174
175
		FormLayout formLayout = new FormLayout();
176
		formLayout.marginWidth = Const.FORM_MARGIN;
177
		formLayout.marginHeight = Const.FORM_MARGIN;
178
179
		shell.setLayout(formLayout);
180
181
		shell.setText(dialogTitle);
182
183
		int middle = props.getMiddlePct();
184
		int margin = Const.MARGIN;
185
186
		// Adiciona um label e um input text no topo do dialog shell
187
		wlStepname = new Label(shell, SWT.RIGHT);
188
		wlStepname.setText(BaseMessages.getString(PKG, "ObjectPropertyMappingStep.StepNameField.Label"));
189
		props.setLook(wlStepname);
190
191
		fdlStepname = new FormData();
192
		fdlStepname.left = new FormAttachment(0, 0);
193
		fdlStepname.right = new FormAttachment(middle, -margin);
194
		fdlStepname.top = new FormAttachment(0, margin);
195
		wlStepname.setLayoutData(fdlStepname);
196
197
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
198
		wStepname.setText(stepname);
199
		props.setLook(wStepname);
200
201
		wStepname.addModifyListener(lsMod);
202
		fdStepname = new FormData();
203
		fdStepname.left = new FormAttachment(middle, 0);
204
		fdStepname.top = new FormAttachment(0, margin);
205
		fdStepname.right = new FormAttachment(100, 0);
206
		wStepname.setLayoutData(fdStepname);
207
		Control lastControl = wStepname;
208
209
		// Chama metodo que adiciona os widgets especificos da janela
210
		lastControl = buildContents(lastControl, lsMod);
211
212
		// Bottom buttons
213
		wOK = new Button(shell, SWT.PUSH);
214
		wOK.setText(BaseMessages.getString(PKG, "ObjectPropertyMappingStep.Btn.OK")); //$NON-NLS-1$
215
		wCancel = new Button(shell, SWT.PUSH);
216
		wCancel.setText(BaseMessages.getString(PKG, "ObjectPropertyMappingStep.Btn.Cancel")); //$NON-NLS-1$
217
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
218
219
		// Add listeners
220
		lsCancel = new Listener() {
221
			public void handleEvent(Event e) {
222
				cancel();
223
			}
224
		};
225
		lsOK = new Listener() {
226
			public void handleEvent(Event e) {
227
				ok();
228
			}
229
		};
230
231
		wCancel.addListener(SWT.Selection, lsCancel);
232
		wOK.addListener(SWT.Selection, lsOK);
233
234
		// It closes the window affirmatively when the user press enter in one
235
		// of the text input fields
236
		lsDef = new SelectionAdapter() {
237
			public void widgetDefaultSelected(SelectionEvent e) {
238
				ok();
239
			}
240
		};
241
		wStepname.addSelectionListener(lsDef);
242
		addSelectionListenerToControls(lsDef);
243
244
		// Detect X or ALT-F4 or something that kills this window...
245
		shell.addShellListener(new ShellAdapter() {
246
			public void shellClosed(ShellEvent e) {
247
				cancel();
248
			}
249
		});
250
251
		// Populate the data of the controls
252
		getData();
253
254
		// Set the shell size, based upon previous time...
255
		setSize();
256
257
		input.setChanged(changed);
258
259
		shell.open();
260
		while (!shell.isDisposed()) {
261
			if (!display.readAndDispatch())
262
				display.sleep();
263
		}
264
		return stepname;
265
	}
266
267
	private void getData() {

plugins/LinkDiscoveryTool/src/main/java/br/ufrj/ppgi/greco/kettle/LinkDiscoveryToolStepDialog.java 1 location

@@ 293-396 (lines=104) @@
290
		wOutputGraph.addSelectionListener(lsDef);
291
	}
292
293
	public String open() {
294
295
		Shell parent = getParent();
296
		Display display = parent.getDisplay();
297
298
		shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
299
		props.setLook(shell);
300
		setShellImage(shell, input);
301
302
		ModifyListener lsMod = new ModifyListener() {
303
304
			public void modifyText(ModifyEvent e) {
305
				input.setChanged();
306
			}
307
		};
308
		boolean changed = input.hasChanged();
309
310
		FormLayout formLayout = new FormLayout();
311
		formLayout.marginWidth = Const.FORM_MARGIN;
312
		formLayout.marginHeight = Const.FORM_MARGIN;
313
314
		shell.setLayout(formLayout);
315
316
		shell.setText(dialogTitle);
317
318
		int middle = props.getMiddlePct();
319
		int margin = Const.MARGIN;
320
321
		// Adiciona um label e um input text no topo do dialog shell
322
		wlStepname = new Label(shell, SWT.RIGHT);
323
		wlStepname.setText("Step Name");
324
		props.setLook(wlStepname);
325
326
		fdlStepname = new FormData();
327
		fdlStepname.left = new FormAttachment(0, 0);
328
		fdlStepname.right = new FormAttachment(middle, -margin);
329
		fdlStepname.top = new FormAttachment(0, margin);
330
		wlStepname.setLayoutData(fdlStepname);
331
332
		wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
333
		wStepname.setText(stepname);
334
		props.setLook(wStepname);
335
336
		wStepname.addModifyListener(lsMod);
337
		fdStepname = new FormData();
338
		fdStepname.left = new FormAttachment(middle, 0);
339
		fdStepname.top = new FormAttachment(0, margin);
340
		fdStepname.right = new FormAttachment(100, 0);
341
		wStepname.setLayoutData(fdStepname);
342
		Control lastControl = wStepname;
343
344
		lastControl = buildContents(lastControl, lsMod);
345
346
		// Bottom buttons
347
		wOK = new Button(shell, SWT.PUSH);
348
		wOK.setText("OK"); //$NON-NLS-1$
349
		wCancel = new Button(shell, SWT.PUSH);
350
		wCancel.setText("Cancel"); //$NON-NLS-1$
351
		setButtonPositions(new Button[] { wOK, wCancel }, margin, lastControl);
352
353
		// Add listeners
354
		lsCancel = new Listener() {
355
			public void handleEvent(Event e) {
356
				cancel();
357
			}
358
		};
359
		lsOK = new Listener() {
360
			public void handleEvent(Event e) {
361
				ok();
362
			}
363
		};
364
365
		wCancel.addListener(SWT.Selection, lsCancel);
366
		wOK.addListener(SWT.Selection, lsOK);
367
368
		lsDef = new SelectionAdapter() {
369
			public void widgetDefaultSelected(SelectionEvent e) {
370
				ok();
371
			}
372
		};
373
		wStepname.addSelectionListener(lsDef);
374
		addSelectionListenerToControls(lsDef);
375
376
		// Detect X or ALT-F4 or something that kills this window...
377
		shell.addShellListener(new ShellAdapter() {
378
			public void shellClosed(ShellEvent e) {
379
				cancel();
380
			}
381
		});
382
383
		// Populate the data of the controls
384
		getData();
385
386
		// Set the shell size, based upon previous time...
387
		setSize();
388
389
		input.setChanged(changed);
390
391
		shell.open();
392
		while (!shell.isDisposed()) {
393
			if (!display.readAndDispatch())
394
				display.sleep();
395
		}
396
		return stepname;
397
	}
398
399
	private void getData() {