Пример #1
0
 @Override
 public void createPartControl(Composite parent) {
   this.parent = parent;
   huiComposite = new HitroUIComposite(parent, false);
   try {
     // no validation here, so empty list passed
     huiComposite.createView(
         attachment.getEntity(),
         true,
         true,
         new String[] {},
         false,
         new ArrayList<String>(0),
         Activator.getDefault()
             .getPreferenceStore()
             .getBoolean(PreferenceConstants.USE_VALIDATION_GUI_HINTS));
   } catch (DBException e) {
     LOG.error("Error while creating editor", e); // $NON-NLS-1$
   }
   InputHelperFactory.setInputHelpers(
       HitroUtil.getInstance()
           .getTypeFactory()
           .getEntityType(attachment.getEntity().getEntityType()),
       huiComposite);
 }
Пример #2
0
 @Override
 public void doSave(IProgressMonitor monitor) {
   monitor.beginTask(Messages.AttachmentEditor_1, IProgressMonitor.UNKNOWN);
   boolean isNew = attachment.getDbId() == null;
   Set<INoteChangedListener> listener = attachment.getListener();
   SaveNote command = new SaveNote(attachment);
   try {
     command = getCommandService().executeCommand(command);
     attachment = (Attachment) command.getAddition();
     huiComposite.dispose();
     huiComposite = new HitroUIComposite(parent, false);
     huiComposite.createView(
         attachment.getEntity(),
         true,
         true,
         new String[] {},
         false,
         ServiceFactory.lookupValidationService()
             .getPropertyTypesToValidate(attachment.getEntity(), attachment.getDbId()),
         Activator.getDefault()
             .getPreferenceStore()
             .getBoolean(PreferenceConstants.USE_VALIDATION_GUI_HINTS));
     parent.layout();
     // file-data is immutable, just save new file-data
     if (isNew) {
       AttachmentFileCreationFactory.createAttachmentFile(
           attachment, FileUtils.readFileToByteArray(new File(attachment.getFilePath())));
     }
   } catch (Exception e) {
     LOG.error("Error while saving file", e); // $NON-NLS-1$
     ExceptionUtil.log(e, Messages.AttachmentEditor_3);
   }
   monitor.done();
   attachment.getListener().addAll(listener);
   isModelModified = false;
   firePropertyChange(IEditorPart.PROP_DIRTY);
   attachment.getEntity().addChangeListener(this.modelListener);
   setPartName(attachment.getTitel());
   attachment.fireChange();
 }