inputPatternTextData.top = top2;
inputPatternTextData.right = new FormAttachment(1000, 1000, -65);
inputPatternText.setLayoutData(inputPatternTextData);
inputPatternText.setText(".+\\.xmi");
decoFileFilterPattern = new ControlDecoration(this.inputPatternText, SWT.TOP | SWT.LEFT);
Image imageError = FieldDecorationRegistry.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
decoFileFilterPattern.setDescriptionText("PatternSyntaxException for this regular expression.");
decoFileFilterPattern.setImage(imageError);
decoFileFilterPattern.hide();
inputPatternText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// without that listener, the text fields forget the
// last change when leaving with tab! don't know why!
// we also MUST call getText() otherwise the changes in
// the field are lost (what is this???!!)
Text t = (Text) e.widget;
decoFileFilterPattern.hide();
}
});
// next row
FormAttachment top3 = new FormAttachment(labelFileFilter, 10);
labelTypeSystem = new Label(this, SWT.NONE);
FormData label3LData = new FormData();
label3LData.width = 70;
label3LData.left = new FormAttachment(0, 1000, 12);
label3LData.top = top3;
labelTypeSystem.setLayoutData(label3LData);
labelTypeSystem.setText("Type System:");
typeSystemFileText = new Text(this, SWT.SINGLE | SWT.BORDER);
FormData preFileTexLData = new FormData();
preFileTexLData.width = 150;
preFileTexLData.left = new FormAttachment(labelTypeSystem, 10);
preFileTexLData.top = top3;
preFileTexLData.right = new FormAttachment(1000, 1000, -65);
typeSystemFileText.setLayoutData(preFileTexLData);
typeSystemFileText.setText("");
typeSystemFileText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// without that listener, the text fields forget the
// last change when leaving with tab! don't know why!
// we also MUST call getText() otherwise the changes in
// the field are lost (what is this???!!)
Text t = (Text) e.widget;
t.getText();
}
});
fileChooseButton = new Button(this, SWT.PUSH | SWT.CENTER);
FormData fileChooseButtoLData = new FormData();
fileChooseButtoLData.width = 25;
fileChooseButtoLData.height = 25;
fileChooseButtoLData.top = top3;
fileChooseButtoLData.right = new FormAttachment(1000, 1000, -35);
fileChooseButton.setLayoutData(fileChooseButtoLData);
Image icon = getImage("prepFolder");
fileChooseButton.setImage(icon);
fileChooseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
fd.setText("Choose Type System Descriptor or Ruta Script");
String[] filterExt = { "*.ruta", "*.*" };
fd.setFilterExtensions(filterExt);
String file = fd.open();
if (file != null) {
typeSystemFileText.setText(file);
}
}
});
// next row: query rules
FormAttachment top4 = new FormAttachment(labelTypeSystem, 10);
Composite compositeQueryRules = new Composite(this, SWT.CENTER);
FormData compData = new FormData();
// compData.width = 300;
compData.height = 100;
compData.left = new FormAttachment(0, 1000, 10);
compData.top = top4;
compData.right = new FormAttachment(1000, 1000, -10);
// compData.left = new FormAttachment(0, 1000, 12);
// compData.top = new FormAttachment(0, 1000, 70);
// compData.bottom = new FormAttachment(0, 1000, -10);
// compData.right = new FormAttachment(1000, 1000, -10);
// compData.width = 109;
// composite1.setSize(500, 500);
compositeQueryRules.setLayoutData(compData);
compositeQueryRules.setLayout(new FillLayout());
IDLTKUILanguageToolkit toolkit = DLTKUILanguageManager.getLanguageToolkit(RutaLanguageToolkit
.getDefault().getNatureId());
final ScriptTextTools textTools = toolkit.getTextTools();
IPreferenceStore store = toolkit.getCombinedPreferenceStore();
viewer = new ScriptSourceViewer(compositeQueryRules, null, null, false, SWT.H_SCROLL
| SWT.V_SCROLL | SWT.BORDER, store);
ScriptSourceViewerConfiguration configuration = textTools.createSourceViewerConfiguraton(
store, (ITextEditor) null);
viewer.configure(configuration);
setInformation("");
compositeQueryRules.layout();
viewer.addTextListener(new ITextListener() {
public void textChanged(TextEvent arg0) {
setRutaQuerySyntaxError(false);
}
});
decoQueryRules = new ControlDecoration(compositeQueryRules, SWT.TOP | SWT.LEFT);
decoQueryRules.setDescriptionText("Could not run query, maybe illegal Ruta rule syntax.");
decoQueryRules.setImage(imageError);
decoQueryRules.hide();
// TODO
// inputPatternText.addModifyListener(new ModifyListener() {