示例#1
0
 public ImageDescriptor getImageDescriptor(MUILabel element) {
   String iconURI = element.getIconURI();
   if (iconURI != null && iconURI.length() > 0) {
     return imageDescriptorFromURI(URI.createURI(iconURI));
   }
   return null;
 }
  @Inject
  public void setSelection(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Contact contact) {
    if (contact != null) {
      if (dirtyable.isDirty()) {
        MessageDialog dialog =
            new MessageDialog(
                detailComposite.getShell(),
                "Save vCard",
                null,
                "The current vCard has been modified. Save changes?",
                MessageDialog.CONFIRM,
                new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
                0);
        dialog.create();
        ThemeUtil.applyDialogStyles(engine, dialog.getShell());
        if (dialog.open() == Window.OK) {
          ParameterizedCommand saveCommand =
              commandService.createCommand("contacts.save", Collections.EMPTY_MAP);
          handlerService.executeHandler(saveCommand);
        }
      }

      updatePartTitle(contact);
    } else {
      uiItem.setLabel("Details");
    }
    dirtyable.setDirty(false);
    if (!detailComposite.isDisposed()) {
      detailComposite.update(contact);
    }
  }
 private ImageDescriptor getImageDescriptor(MUILabel element) {
   IEclipseContext localContext = context;
   String iconURI = element.getIconURI();
   if (iconURI != null && iconURI.length() > 0) {
     ISWTResourceUtilities resUtils =
         (ISWTResourceUtilities) localContext.get(IResourceUtilities.class.getName());
     return resUtils.imageDescriptorFromURI(URI.createURI(iconURI));
   }
   return null;
 }
示例#4
0
 protected Image getImage(MUILabel element) {
   String iconURI = element.getIconURI();
   if (iconURI != null && iconURI.length() > 0) {
     Image image = imageMap.get(iconURI);
     if (image == null) {
       image = imageDescriptorFromURI(URI.createURI(iconURI)).createImage();
       imageMap.put(iconURI, image);
     }
     return image;
   }
   return null;
 }
 @PostConstruct
 public void init() {
   // System.out.println("TextField created");
   text = new Text(parent, SWT.SINGLE);
   text.setText(element.getLabel() + " text");
 }
 private void updatePartTitle(Contact contact) {
   StringBuffer title = new StringBuffer("Details of ");
   title.append(contact.getFirstName()).append(' ').append(contact.getLastName());
   uiItem.setLabel(title.toString());
 }