Program: 93181
Project: 93181
Buggy source:
@Override protected void createFormContent(IManagedForm managedForm){
  FormToolkit toolkit=managedForm.getToolkit();
  ScrolledForm form=managedForm.getForm();
  form.setText(Messages.EDITOR_TITLE_METADATA);
  Composite body=form.getBody();
  toolkit.decorateFormHeading(form.getForm());
  toolkit.paintBordersFor(body);
  managedForm.getForm().getBody().setLayout(new GridLayout(3,false));
  contentsPart=new AbstractFormPart(){
    @Override public void initialize(    IManagedForm managedForm){
      super.initialize(managedForm);
      Label lblName=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_NAME,SWT.NONE);
      lblName.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
      int horizontalIndent=decorationImage.getBounds().width + 2;
      txtName=managedForm.getToolkit().createText(managedForm.getForm().getBody(),snippet.getName(),SWT.NONE);
      txtName.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).span(2,1).indent(horizontalIndent,0).create());
      final ControlDecoration nameDecoration=new ControlDecoration(txtName,SWT.LEFT);
      nameDecoration.setDescriptionText(Messages.ERROR_SNIPPET_NAME_CANNOT_BE_EMPTY);
      nameDecoration.setImage(decorationImage);
      nameDecoration.setMarginWidth(1);
      txtName.addModifyListener(new ModifyListener(){
        @Override public void modifyText(        ModifyEvent arg0){
          if (isNullOrEmpty(txtName.getText())) {
            nameDecoration.show();
          }
 else {
            nameDecoration.hide();
          }
        }
      }
);
      Label lblDescription=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_DESCRIPTION,SWT.NONE);
      lblDescription.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false,1,1));
      txtDescription=managedForm.getToolkit().createText(managedForm.getForm().getBody(),snippet.getDescription(),SWT.NONE);
      txtDescription.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).span(2,1).indent(horizontalIndent,0).create());
      Label lblLocation=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_LOCATION,SWT.NONE);
      lblLocation.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false,1,1));
      comboLocation=new ComboViewer(managedForm.getForm().getBody(),SWT.DROP_DOWN | SWT.READ_ONLY);
      managedForm.getToolkit().adapt(comboLocation.getCombo(),true,true);
      comboLocation.setContentProvider(ArrayContentProvider.getInstance());
      comboLocation.setInput(SNIPMATCH_LOCATIONS);
      comboLocation.setLabelProvider(new LabelProvider(){
        @Override public String getText(        Object element){
          if (element instanceof Location) {
            Location location=(Location)element;
switch (location) {
case FILE:
              return Messages.SNIPMATCH_LOCATION_FILE;
case JAVA:
            return Messages.SNIPMATCH_LOCATION_JAVA;
case JAVA_STATEMENTS:
          return Messages.SNIPMATCH_LOCATION_JAVA_STATEMENTS;
case JAVA_TYPE_MEMBERS:
        return Messages.SNIPMATCH_LOCATION_JAVA_MEMBERS;
case JAVADOC:
      return Messages.SNIPMATCH_LOCATION_JAVADOC;
default :
    break;
}
}
return super.getText(element);
}
}
);
comboLocation.getCombo().setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).span(2,1).indent(horizontalIndent,0).create());
final ControlDecoration locationErrorDecoration=new ControlDecoration(comboLocation.getCombo(),SWT.LEFT);
locationErrorDecoration.setDescriptionText(Messages.ERROR_SNIPPET_LOCATION_CANNOT_BE_EMPTY + "String_Node_Str" + Messages.EDITOR_DESCRIPTION_LOCATION);
locationErrorDecoration.setImage(decorationImage);
locationErrorDecoration.setMarginWidth(1);
final ControlDecoration locationDescriptionDecoration=new ControlDecoration(comboLocation.getCombo(),SWT.LEFT);
FieldDecoration infoDecoration=FieldDecorationRegistry.getDefault().getFieldDecoration(DEC_INFORMATION);
locationDescriptionDecoration.setImage(infoDecoration.getImage());
locationDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_LOCATION);
locationDescriptionDecoration.setMarginWidth(1);
comboLocation.addSelectionChangedListener(new ISelectionChangedListener(){
@Override public void selectionChanged(SelectionChangedEvent event){
if (event.getSelection().isEmpty()) {
locationErrorDecoration.show();
locationDescriptionDecoration.hide();
}
 else {
locationErrorDecoration.hide();
locationDescriptionDecoration.show();
}
}
}
);
comboLocation.setSelection(new StructuredSelection(snippet.getLocation()));
Label lblExtraSearchTerms=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPETS_EXTRA_SEARCH_TERMS,SWT.NONE);
lblExtraSearchTerms.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
listViewerExtraSearchTerms=new ListViewer(managedForm.getForm().getBody(),SWT.BORDER | SWT.V_SCROLL);
List lstExtraSearchTerm=listViewerExtraSearchTerms.getList();
lstExtraSearchTerm.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).indent(horizontalIndent,0).create());
final ControlDecoration extraSearchTermsDescriptionDecoration=new ControlDecoration(listViewerExtraSearchTerms.getList(),SWT.TOP | SWT.LEFT);
extraSearchTermsDescriptionDecoration.setImage(infoDecoration.getImage());
extraSearchTermsDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_EXTRA_SEARCH_TERMS);
extraSearchTermsDescriptionDecoration.setMarginWidth(1);
btnContainerExtraSearchTerms=managedForm.getToolkit().createComposite(managedForm.getForm().getBody(),SWT.NONE);
btnContainerExtraSearchTerms.setLayoutData(new GridData(SWT.LEFT,SWT.FILL,false,false,1,1));
managedForm.getToolkit().paintBordersFor(btnContainerExtraSearchTerms);
btnContainerExtraSearchTerms.setLayout(new GridLayout(1,false));
btnAddExtraSearchTerm=managedForm.getToolkit().createButton(btnContainerExtraSearchTerms,Messages.EDITOR_BUTTON_ADD_EXTRASEARCH_TERM,SWT.NONE);
btnAddExtraSearchTerm.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
createExtraSearchTermInputDialog(btnContainerExtraSearchTerms.getShell()).open();
}
}
);
btnAddExtraSearchTerm.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
btnRemoveExtraSearchTerm=managedForm.getToolkit().createButton(btnContainerExtraSearchTerms,Messages.EDITOR_BUTTON_REMOVE_EXTRA_SEARCH_TERM,SWT.NONE);
btnRemoveExtraSearchTerm.setEnabled(false);
btnRemoveExtraSearchTerm.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Optional<String> o=Selections.getFirstSelected(listViewerExtraSearchTerms);
if (o.isPresent()) {
ppExtraSearchTerms.remove(o.get());
}
}
}
);
btnRemoveExtraSearchTerm.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
Label lblTag=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPETS_TAG,SWT.NONE);
lblTag.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
listViewerTags=new ListViewer(managedForm.getForm().getBody(),SWT.BORDER | SWT.V_SCROLL);
List lstTags=listViewerTags.getList();
lstTags.setLayoutData(GridDataFactory.fillDefaults().grab(true,true).indent(horizontalIndent,0).create());
final ControlDecoration tagsDescriptionDecoration=new ControlDecoration(listViewerTags.getList(),SWT.TOP | SWT.LEFT);
tagsDescriptionDecoration.setImage(infoDecoration.getImage());
tagsDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_TAGS);
tagsDescriptionDecoration.setMarginWidth(1);
btnContainerTags=managedForm.getToolkit().createComposite(managedForm.getForm().getBody(),SWT.NONE);
btnContainerTags.setLayoutData(new GridData(SWT.LEFT,SWT.FILL,false,false,1,1));
managedForm.getToolkit().paintBordersFor(btnContainerExtraSearchTerms);
btnContainerTags.setLayout(new GridLayout(1,false));
btnAddTag=managedForm.getToolkit().createButton(btnContainerTags,Messages.EDITOR_BUTTON_ADD_TAGS,SWT.NONE);
btnAddTag.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
createTagInputDialog(btnContainerTags.getShell()).open();
}
}
);
btnAddTag.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
btnRemoveTag=managedForm.getToolkit().createButton(btnContainerTags,Messages.EDITOR_BUTTON_REMOVE_TAGS,SWT.NONE);
btnRemoveTag.setEnabled(false);
btnRemoveTag.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Optional<String> o=Selections.getFirstSelected(listViewerTags);
if (o.isPresent()) {
ppTags.remove(o.get());
}
}
}
);
btnRemoveTag.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
Label lblDependencies=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_DEPENENCIES,SWT.NONE);
lblDependencies.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
listViewerDependencies=new ListViewer(managedForm.getForm().getBody(),SWT.BORDER | SWT.V_SCROLL);
List lstDependencies=listViewerDependencies.getList();
lstDependencies.setLayoutData(GridDataFactory.fillDefaults().grab(true,true).indent(horizontalIndent,0).create());
final ControlDecoration dependencyDescriptionDecoration=new ControlDecoration(listViewerDependencies.getList(),SWT.TOP | SWT.LEFT);
dependencyDescriptionDecoration.setImage(infoDecoration.getImage());
dependencyDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_DEPENDENCIES);
dependencyDescriptionDecoration.setMarginWidth(1);
btnContainerDependencies=managedForm.getToolkit().createComposite(managedForm.getForm().getBody(),SWT.NONE);
btnContainerDependencies.setLayoutData(new GridData(SWT.LEFT,SWT.FILL,false,false,1,1));
managedForm.getToolkit().paintBordersFor(btnContainerDependencies);
btnContainerDependencies.setLayout(new GridLayout(1,false));
btnAddDependency=managedForm.getToolkit().createButton(btnContainerDependencies,Messages.EDITOR_BUTTON_ADD_DEPENDENCY,SWT.NONE);
btnAddDependency.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Shell shell=btnContainerDependencies.getShell();
ProjectCoordinateSelectionDialog dialog=new ProjectCoordinateSelectionDialog(shell);
dialog.setInitialPattern("String_Node_Str");
dialog.open();
Object[] result=dialog.getResult();
if (result != null) {
for (Object object : result) {
  ppDependencies.add((ProjectCoordinate)object);
}
}
}
}
);
btnAddDependency.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
btnRemoveDependency=managedForm.getToolkit().createButton(btnContainerDependencies,Messages.EDITOR_BUTTON_REMOVE_TAGS,SWT.NONE);
btnRemoveDependency.setEnabled(false);
btnRemoveDependency.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Optional<String> o=Selections.getFirstSelected(listViewerDependencies);
if (o.isPresent()) {
ppDependencies.remove(o.get());
}
}
}
);
btnRemoveDependency.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
Label lblUuid=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_UUID,SWT.NONE);
lblUuid.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
txtUuid=managedForm.getToolkit().createText(managedForm.getForm().getBody(),snippet.getUuid().toString(),SWT.READ_ONLY);
txtUuid.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).indent(horizontalIndent,0).create());
}
@Override public void commit(boolean onSave){
if (onSave) {
super.commit(onSave);
}
}
@Override public void refresh(){
context.updateTargets();
super.refresh();
}
}
;
managedForm.addPart(contentsPart);
context=createDataBindingContext();
}

Fixed version (ground truth):
@Override protected void createFormContent(IManagedForm managedForm){
  FormToolkit toolkit=managedForm.getToolkit();
  ScrolledForm form=managedForm.getForm();
  form.setText(Messages.EDITOR_TITLE_METADATA);
  Composite body=form.getBody();
  toolkit.decorateFormHeading(form.getForm());
  toolkit.paintBordersFor(body);
  managedForm.getForm().getBody().setLayout(new GridLayout(3,false));
  contentsPart=new AbstractFormPart(){
    @Override public void initialize(    IManagedForm managedForm){
      super.initialize(managedForm);
      Label lblName=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_NAME,SWT.NONE);
      lblName.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
      int horizontalIndent=decorationImage.getBounds().width + 2;
      txtName=managedForm.getToolkit().createText(managedForm.getForm().getBody(),snippet.getName(),SWT.NONE);
      txtName.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).span(2,1).indent(horizontalIndent,0).create());
      final ControlDecoration nameDecoration=new ControlDecoration(txtName,SWT.LEFT);
      nameDecoration.setDescriptionText(Messages.ERROR_SNIPPET_NAME_CANNOT_BE_EMPTY);
      nameDecoration.setImage(decorationImage);
      nameDecoration.setMarginWidth(1);
      txtName.addModifyListener(new ModifyListener(){
        @Override public void modifyText(        ModifyEvent arg0){
          if (isNullOrEmpty(txtName.getText())) {
            nameDecoration.show();
          }
 else {
            nameDecoration.hide();
          }
        }
      }
);
      Label lblDescription=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_DESCRIPTION,SWT.NONE);
      lblDescription.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false,1,1));
      txtDescription=managedForm.getToolkit().createText(managedForm.getForm().getBody(),snippet.getDescription(),SWT.NONE);
      txtDescription.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).span(2,1).indent(horizontalIndent,0).create());
      Label lblLocation=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_LOCATION,SWT.NONE);
      lblLocation.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false,1,1));
      comboLocation=new ComboViewer(managedForm.getForm().getBody(),SWT.DROP_DOWN | SWT.READ_ONLY);
      managedForm.getToolkit().adapt(comboLocation.getCombo(),true,true);
      comboLocation.setContentProvider(ArrayContentProvider.getInstance());
      comboLocation.setInput(SNIPMATCH_LOCATIONS);
      comboLocation.setLabelProvider(new LabelProvider(){
        @Override public String getText(        Object element){
          if (element instanceof Location) {
            Location location=(Location)element;
switch (location) {
case FILE:
              return Messages.SNIPMATCH_LOCATION_FILE;
case JAVA:
            return Messages.SNIPMATCH_LOCATION_JAVA;
case JAVA_STATEMENTS:
          return Messages.SNIPMATCH_LOCATION_JAVA_STATEMENTS;
case JAVA_TYPE_MEMBERS:
        return Messages.SNIPMATCH_LOCATION_JAVA_MEMBERS;
case JAVADOC:
      return Messages.SNIPMATCH_LOCATION_JAVADOC;
default :
    break;
}
}
return super.getText(element);
}
}
);
comboLocation.getCombo().setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL,SWT.CENTER).grab(true,false).span(2,1).indent(horizontalIndent,0).create());
final ControlDecoration locationErrorDecoration=new ControlDecoration(comboLocation.getCombo(),SWT.LEFT);
locationErrorDecoration.setDescriptionText(Messages.ERROR_SNIPPET_LOCATION_CANNOT_BE_EMPTY + "String_Node_Str" + Messages.EDITOR_DESCRIPTION_LOCATION);
locationErrorDecoration.setImage(decorationImage);
locationErrorDecoration.setMarginWidth(1);
final ControlDecoration locationDescriptionDecoration=new ControlDecoration(comboLocation.getCombo(),SWT.LEFT);
FieldDecoration infoDecoration=FieldDecorationRegistry.getDefault().getFieldDecoration(DEC_INFORMATION);
locationDescriptionDecoration.setImage(infoDecoration.getImage());
locationDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_LOCATION);
locationDescriptionDecoration.setMarginWidth(1);
comboLocation.addSelectionChangedListener(new ISelectionChangedListener(){
@Override public void selectionChanged(SelectionChangedEvent event){
if (event.getSelection().isEmpty()) {
locationErrorDecoration.show();
locationDescriptionDecoration.hide();
}
 else {
locationErrorDecoration.hide();
locationDescriptionDecoration.show();
}
}
}
);
comboLocation.setSelection(new StructuredSelection(snippet.getLocation()));
Label lblExtraSearchTerms=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPETS_EXTRA_SEARCH_TERMS,SWT.NONE);
lblExtraSearchTerms.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
listViewerExtraSearchTerms=new ListViewer(managedForm.getForm().getBody(),SWT.BORDER | SWT.V_SCROLL);
List lstExtraSearchTerm=listViewerExtraSearchTerms.getList();
lstExtraSearchTerm.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).indent(horizontalIndent,0).create());
final ControlDecoration extraSearchTermsDescriptionDecoration=new ControlDecoration(listViewerExtraSearchTerms.getList(),SWT.TOP | SWT.LEFT);
extraSearchTermsDescriptionDecoration.setImage(infoDecoration.getImage());
extraSearchTermsDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_EXTRA_SEARCH_TERMS);
extraSearchTermsDescriptionDecoration.setMarginWidth(1);
btnContainerExtraSearchTerms=managedForm.getToolkit().createComposite(managedForm.getForm().getBody(),SWT.NONE);
btnContainerExtraSearchTerms.setLayoutData(new GridData(SWT.LEFT,SWT.FILL,false,false,1,1));
managedForm.getToolkit().paintBordersFor(btnContainerExtraSearchTerms);
btnContainerExtraSearchTerms.setLayout(new GridLayout(1,false));
btnAddExtraSearchTerm=managedForm.getToolkit().createButton(btnContainerExtraSearchTerms,Messages.EDITOR_BUTTON_ADD_EXTRASEARCH_TERM,SWT.NONE);
btnAddExtraSearchTerm.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
createExtraSearchTermInputDialog(btnContainerExtraSearchTerms.getShell()).open();
}
}
);
btnAddExtraSearchTerm.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
btnRemoveExtraSearchTerm=managedForm.getToolkit().createButton(btnContainerExtraSearchTerms,Messages.EDITOR_BUTTON_REMOVE_EXTRA_SEARCH_TERM,SWT.NONE);
btnRemoveExtraSearchTerm.setEnabled(false);
btnRemoveExtraSearchTerm.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Optional<String> o=Selections.getFirstSelected(listViewerExtraSearchTerms);
if (o.isPresent()) {
ppExtraSearchTerms.remove(o.get());
}
}
}
);
btnRemoveExtraSearchTerm.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
Label lblTag=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPETS_TAG,SWT.NONE);
lblTag.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
listViewerTags=new ListViewer(managedForm.getForm().getBody(),SWT.BORDER | SWT.V_SCROLL);
List lstTags=listViewerTags.getList();
lstTags.setLayoutData(GridDataFactory.fillDefaults().grab(true,true).indent(horizontalIndent,0).create());
final ControlDecoration tagsDescriptionDecoration=new ControlDecoration(listViewerTags.getList(),SWT.TOP | SWT.LEFT);
tagsDescriptionDecoration.setImage(infoDecoration.getImage());
tagsDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_TAGS);
tagsDescriptionDecoration.setMarginWidth(1);
btnContainerTags=managedForm.getToolkit().createComposite(managedForm.getForm().getBody(),SWT.NONE);
btnContainerTags.setLayoutData(new GridData(SWT.LEFT,SWT.FILL,false,false,1,1));
managedForm.getToolkit().paintBordersFor(btnContainerExtraSearchTerms);
btnContainerTags.setLayout(new GridLayout(1,false));
btnAddTag=managedForm.getToolkit().createButton(btnContainerTags,Messages.EDITOR_BUTTON_ADD_TAGS,SWT.NONE);
btnAddTag.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
createTagInputDialog(btnContainerTags.getShell()).open();
}
}
);
btnAddTag.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
btnRemoveTag=managedForm.getToolkit().createButton(btnContainerTags,Messages.EDITOR_BUTTON_REMOVE_TAGS,SWT.NONE);
btnRemoveTag.setEnabled(false);
btnRemoveTag.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Optional<String> o=Selections.getFirstSelected(listViewerTags);
if (o.isPresent()) {
ppTags.remove(o.get());
}
}
}
);
btnRemoveTag.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
Label lblDependencies=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_DEPENENCIES,SWT.NONE);
lblDependencies.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
listViewerDependencies=new ListViewer(managedForm.getForm().getBody(),SWT.BORDER | SWT.V_SCROLL);
List lstDependencies=listViewerDependencies.getList();
lstDependencies.setLayoutData(GridDataFactory.fillDefaults().grab(true,true).indent(horizontalIndent,0).create());
final ControlDecoration dependencyDescriptionDecoration=new ControlDecoration(listViewerDependencies.getList(),SWT.TOP | SWT.LEFT);
dependencyDescriptionDecoration.setImage(infoDecoration.getImage());
dependencyDescriptionDecoration.setDescriptionText(Messages.EDITOR_DESCRIPTION_DEPENDENCIES);
dependencyDescriptionDecoration.setMarginWidth(1);
btnContainerDependencies=managedForm.getToolkit().createComposite(managedForm.getForm().getBody(),SWT.NONE);
btnContainerDependencies.setLayoutData(new GridData(SWT.LEFT,SWT.FILL,false,false,1,1));
managedForm.getToolkit().paintBordersFor(btnContainerDependencies);
btnContainerDependencies.setLayout(new GridLayout(1,false));
btnAddDependency=managedForm.getToolkit().createButton(btnContainerDependencies,Messages.EDITOR_BUTTON_ADD_DEPENDENCY,SWT.NONE);
btnAddDependency.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Shell shell=btnContainerDependencies.getShell();
ProjectCoordinateSelectionDialog dialog=new ProjectCoordinateSelectionDialog(shell);
dialog.setInitialPattern("String_Node_Str");
dialog.open();
Object[] result=dialog.getResult();
if (result != null) {
for (Object object : result) {
  ppDependencies.add(object);
}
}
}
}
);
btnAddDependency.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
btnRemoveDependency=managedForm.getToolkit().createButton(btnContainerDependencies,Messages.EDITOR_BUTTON_REMOVE_TAGS,SWT.NONE);
btnRemoveDependency.setEnabled(false);
btnRemoveDependency.addSelectionListener(new SelectionAdapter(){
@Override public void widgetSelected(SelectionEvent e){
Optional<String> o=Selections.getFirstSelected(listViewerDependencies);
if (o.isPresent()) {
ppDependencies.remove(o.get());
}
}
}
);
btnRemoveDependency.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,false,false,1,1));
Label lblUuid=managedForm.getToolkit().createLabel(managedForm.getForm().getBody(),Messages.EDITOR_LABEL_SNIPPET_UUID,SWT.NONE);
lblUuid.setLayoutData(new GridData(SWT.RIGHT,SWT.TOP,false,false,1,1));
txtUuid=managedForm.getToolkit().createText(managedForm.getForm().getBody(),snippet.getUuid().toString(),SWT.READ_ONLY);
txtUuid.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).indent(horizontalIndent,0).create());
}
@Override public void commit(boolean onSave){
if (onSave) {
super.commit(onSave);
}
}
@Override public void refresh(){
context.updateTargets();
super.refresh();
}
}
;
managedForm.addPart(contentsPart);
context=createDataBindingContext();
}