Exemplo n.º 1
0
 private void updateBgColor() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setBackground(bgColors[bgIndex]);
   }
 }
Exemplo n.º 2
0
 private void updateFgColor() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setForeground(fgColors[fgIndex]);
   }
 }
  public void addSelectedFilesToTargetList() {
    ISelection selection = sourceFileViewer.getSelection();

    if (isValidSourceFileViewerSelection(selection)) {
      java.util.List list = null;
      if (selection instanceof IStructuredSelection) {
        list = ((IStructuredSelection) selection).toList();

        if (list != null) {
          list = ((IStructuredSelection) selection).toList();
          for (Iterator i = list.iterator(); i.hasNext(); ) {
            IResource resource = (IResource) i.next();
            if (resource instanceof IFile) {
              // Check if its in the list. Don't add it if it is.
              String resourceName = resource.getFullPath().toString();
              if (selectedListBox.indexOf(resourceName) == -1) selectedListBox.add(resourceName);
            }
          }
          setFiles(selectedListBox.getItems());
        }

        setAddButtonEnabled(false);

        if (selectedListBox.getItemCount() > 0) {
          removeAllButton.setEnabled(true);
          if (isFileMandatory) setPageComplete(true);
          if (selectedListBox.getSelectionCount() > 0) setRemoveButtonEnabled(true);
          else setRemoveButtonEnabled(false);
        }
      }
    }
  }
Exemplo n.º 4
0
 private void updateVisible() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setVisible(visible);
   }
 }
  public AuthenticatorWindow() {
    SESecurityManager.addPasswordListener(this);

    // System.out.println( "AuthenticatorWindow");

    Map cache = COConfigurationManager.getMapParameter(CONFIG_PARAM, new HashMap());

    try {
      Iterator it = cache.entrySet().iterator();

      while (it.hasNext()) {

        Map.Entry entry = (Map.Entry) it.next();

        String key = (String) entry.getKey();
        Map value = (Map) entry.getValue();

        String user = new String((byte[]) value.get("user"), "UTF-8");
        char[] pw = new String((byte[]) value.get("pw"), "UTF-8").toCharArray();

        auth_cache.put(key, new authCache(key, new PasswordAuthentication(user, pw), true));
      }

    } catch (Throwable e) {

      COConfigurationManager.setParameter(CONFIG_PARAM, new HashMap());

      Debug.printStackTrace(e);
    }
  }
Exemplo n.º 6
0
 private void updateBgImage() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setBackgroundImage(showBgImage ? BG_PATTERN_IMAGE : null);
   }
 }
Exemplo n.º 7
0
 private void updateEnabled() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setEnabled(enabled);
   }
 }
Exemplo n.º 8
0
  public void removeFromShare(List avatars) {

    for (Iterator iterator = avatars.iterator(); iterator.hasNext(); ) {
      Object object = (Object) iterator.next();
      if (object instanceof AvatarWidget) {
        removeFromShare((AvatarWidget) object);
      }
    }
  }
Exemplo n.º 9
0
  public void addSelectionToShare() {

    for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
      AvatarWidget widget = (AvatarWidget) iterator.next();
      if (true == widget.isSelected()) {
        addToShare(widget);
      }
    }
  }
Exemplo n.º 10
0
 /**
  * Return a list of <code>VuzeBuddySWT</code> that are currently selected
  *
  * @return
  */
 public List getSelection() {
   List selected = new ArrayList();
   for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
     AvatarWidget widget = (AvatarWidget) iterator.next();
     if (true == widget.isSelected()) {
       selected.add(widget.getVuzeBuddy());
     }
   }
   return selected;
 }
  public XMLComparePreferencePage() {
    super();

    fIdMaps = new HashMap();
    XMLPlugin plugin = XMLPlugin.getDefault();
    HashMap PluginIdMaps = plugin.getIdMaps();
    Set keySet = PluginIdMaps.keySet();
    for (Iterator iter = keySet.iterator(); iter.hasNext(); ) {
      String key = (String) iter.next();
      fIdMaps.put(key, ((HashMap) PluginIdMaps.get(key)).clone());
    }
    fIdMapsInternal = plugin.getIdMapsInternal();

    fIdExtensionToName = new HashMap();
    HashMap PluginIdExtensionToName = plugin.getIdExtensionToName();
    keySet = PluginIdExtensionToName.keySet();
    for (Iterator iter = keySet.iterator(); iter.hasNext(); ) {
      String key = (String) iter.next();
      fIdExtensionToName.put(key, PluginIdExtensionToName.get(key));
    }

    fOrderedElements = new HashMap();
    HashMap PluginOrderedElements = plugin.getOrderedElements();
    keySet = PluginOrderedElements.keySet();
    for (Iterator iter = keySet.iterator(); iter.hasNext(); ) {
      String key = (String) iter.next();
      fOrderedElements.put(key, ((ArrayList) PluginOrderedElements.get(key)).clone());
    }

    fOrderedElementsInternal = plugin.getOrderedElementsInternal();
  }
Exemplo n.º 12
0
 public void setVisible(boolean visible) {
   if (visible == true) {
     if (fFilters != null) {
       sourceFileViewer.resetFilters();
       for (Iterator i = fFilters.iterator(); i.hasNext(); )
         sourceFileViewer.addFilter((ViewerFilter) i.next());
     }
     sourceFileViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
   }
   super.setVisible(visible);
 }
Exemplo n.º 13
0
 private void updateFont() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setFont(font);
   }
   // Force layout
   if (controls.size() > 0) {
     Composite parent = ((Control) controls.get(0)).getParent();
     parent.layout(true, true);
   }
 }
Exemplo n.º 14
0
  public void setEditMode(boolean value) {
    if (isEditMode != value) {
      isEditMode = value;
      for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
        AvatarWidget widget = (AvatarWidget) iterator.next();
        widget.refreshVisual();
      }

      if (true == value) {
        setShareMode(false, null);
        setAddBuddyMode(false);
      }
    }
  }
Exemplo n.º 15
0
  private AvatarWidget findWidget(VuzeBuddy buddy) {
    if (null != buddy) {
      for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
        AvatarWidget widget = (AvatarWidget) iterator.next();
        if (null != widget.getVuzeBuddy()) {
          if (true == buddy.getLoginID().equals(widget.getVuzeBuddy().getLoginID())) {
            return widget;
          }
        }
      }
    }

    return null;
  }
Exemplo n.º 16
0
  private void fillBuddies(Composite composite) {

    List buddies = getBuddies();

    showNoBuddiesPanel(buddies.size() == 0);

    for (Iterator iterator = buddies.iterator(); iterator.hasNext(); ) {
      VuzeBuddySWT vuzeBuddy = (VuzeBuddySWT) iterator.next();
      createBuddyControls(composite, vuzeBuddy);
    }
    composite.layout();
    Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    composite.setSize(size);
  }
Exemplo n.º 17
0
 private void updateRoundedBorder(
     final int width,
     final Color color,
     final int topLeft,
     final int topRight,
     final int bottomRight,
     final int bottomLeft) {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     Object adapter = control.getAdapter(IWidgetGraphicsAdapter.class);
     IWidgetGraphicsAdapter gfxAdapter = (IWidgetGraphicsAdapter) adapter;
     gfxAdapter.setRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft);
   }
 }
 protected static void setOrdered(IdMap idmap, ArrayList idmapOrdered) {
   ArrayList Ordered = new ArrayList();
   for (Iterator iter_ordered = idmapOrdered.iterator(); iter_ordered.hasNext(); ) {
     Mapping mapping = new Mapping();
     String signature = (String) iter_ordered.next();
     int end_of_signature = signature.lastIndexOf(SIGN_SEPARATOR, signature.length() - 2);
     if (end_of_signature < XMLStructureCreator.ROOT_ID.length() + 1)
       mapping.setSignature(""); // $NON-NLS-1$
     else
       mapping.setSignature(
           signature.substring(XMLStructureCreator.ROOT_ID.length() + 1, end_of_signature));
     mapping.setElement(signature.substring(end_of_signature + 1, signature.length() - 1));
     Ordered.add(mapping);
   }
   idmap.setOrdered(Ordered);
 }
Exemplo n.º 19
0
  public void removeFromShare(VuzeBuddy buddy) {

    if (null != buddy) {
      for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
        AvatarWidget widget = (AvatarWidget) iterator.next();
        if (null != widget.getVuzeBuddy()) {
          if (true == buddy.getLoginID().equals(widget.getVuzeBuddy().getLoginID())) {
            if (sharePage != null) {
              sharePage.removeBuddy(widget.getVuzeBuddy());
            }
            widget.setSharedAlready(false);
            break;
          }
        }
      }
    }
  }
Exemplo n.º 20
0
 private void updateCursor(final String selection) {
   Cursor cursor = null;
   Class swtClass = SWT.class;
   if (selection != null) {
     try {
       Field field = swtClass.getField(selection);
       int cursorStyle = field.getInt(swtClass);
       cursor = Display.getCurrent().getSystemCursor(cursorStyle);
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setCursor(cursor);
   }
 }
Exemplo n.º 21
0
 private void updateBgGradient() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     Object adapter = control.getAdapter(IWidgetGraphicsAdapter.class);
     IWidgetGraphicsAdapter gfxAdapter = (IWidgetGraphicsAdapter) adapter;
     if (showBgGradient) {
       Color[] gradientColors =
           new Color[] {
             BGG_COLOR_BLUE, BGG_COLOR_GREEN, BGG_COLOR_BLUE, BGG_COLOR_GREEN, BGG_COLOR_BLUE
           };
       int[] percents = new int[] {0, 25, 50, 75, 100};
       gfxAdapter.setBackgroundGradient(gradientColors, percents);
     } else {
       gfxAdapter.setBackgroundGradient(null, null);
     }
   }
 }
  private void editIdMap(Shell shell) {
    TableItem[] items = fIdMapsTable.getSelection();
    if (items.length > 0) {
      IdMap idmap = (IdMap) items[0].getData();
      XMLCompareEditCopyIdMapDialog dialog =
          new XMLCompareEditCopyIdMapDialog(shell, idmap, fIdMaps, fIdMapsInternal);
      if (dialog.open() == Window.OK) {
        String new_idmapName = dialog.getResult();
        if (!fIdMaps.containsKey(new_idmapName)) {
          // copy over id mappings
          Vector newMappings = new Vector();
          IdMap newIdMap = new IdMap(new_idmapName, false, newMappings);
          HashMap newIdmapHM = new HashMap();
          fIdMaps.put(newIdMap.getName(), newIdmapHM);
          Vector Mappings = idmap.getMappings();
          for (Enumeration enumeration = Mappings.elements(); enumeration.hasMoreElements(); ) {
            Mapping mapping = (Mapping) enumeration.nextElement();
            Mapping newMapping =
                new Mapping(mapping.getElement(), mapping.getSignature(), mapping.getIdAttribute());
            newMappings.add(newMapping);
            newIdmapHM.put(newMapping.getKey(), newMapping.getIdAttribute());
          }
          // copy over ordered entries
          ArrayList orderedAL = idmap.getOrdered();
          if (orderedAL != null && orderedAL.size() > 0) {
            ArrayList newOrderedAL = new ArrayList();
            newIdMap.setOrdered(newOrderedAL);
            ArrayList idmapOrdered = new ArrayList();
            fOrderedElements.put(newIdMap.getName(), idmapOrdered);
            for (Iterator iter = orderedAL.iterator(); iter.hasNext(); ) {
              Mapping ordered = (Mapping) iter.next();
              Mapping newOrdered = new Mapping(ordered.getElement(), ordered.getSignature());
              newOrderedAL.add(newOrdered);
              idmapOrdered.add(newOrdered.getKey());
            }
          }

          newIdMapsTableItem(newIdMap, true);
          selectionChanged();
        }
      }
    }
  }
 protected void selectionChanged() {
   TableItem[] items = fIdMapsTable.getSelection();
   if (items.length > 0) {
     // Refresh Mappings Table
     fMappingsTable.removeAll();
     Vector Mappings = ((IdMap) items[0].getData()).getMappings();
     for (Enumeration enumeration = Mappings.elements(); enumeration.hasMoreElements(); ) {
       newMappingsTableItem((Mapping) enumeration.nextElement(), false);
     }
     // Refresh Ordered Table
     fOrderedTable.removeAll();
     ArrayList Ordered = ((IdMap) items[0].getData()).getOrdered();
     if (Ordered != null) {
       for (Iterator iter_ordered = Ordered.iterator(); iter_ordered.hasNext(); ) {
         newOrderedTableItem((Mapping) iter_ordered.next(), false);
       }
     }
   }
   updateEnabledState();
 }
Exemplo n.º 24
0
  public void setShareMode(boolean isShareMode, SharePage sharePage) {

    this.sharePage = sharePage;

    if (this.isShareMode != isShareMode) {
      this.isShareMode = isShareMode;
      for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
        AvatarWidget widget = (AvatarWidget) iterator.next();
        if (false == isShareMode) {
          widget.setSharedAlready(false);
        }
        widget.refreshVisual();
      }

      if (true == isShareMode) {
        setEditMode(false);
        setAddBuddyMode(false);
      }
    }
  }
Exemplo n.º 25
0
  // --------------------------------------------------------------------------------
  private void drawItem(String parentFieldName, TreeItem parentItem, Map data, boolean expand) {
    Iterator p = data.keySet().iterator();
    while (p.hasNext()) {
      String key = (String) p.next();
      if (!data.containsKey(key)) {
        continue;
      }
      Object value = data.get(key);

      TreeItem newItem = new TreeItem(parentItem, SWT.NONE);
      newItem.setText(1, getClassName(value));

      String fieldName = parentFieldName + "." + key;
      if (fieldName.startsWith(".")) {
        fieldName = fieldName.substring(1);
      }
      newItem.setData("fieldName", fieldName);
      newItem.setData("value", value);
      fieldNameTreeItemMap.put(fieldName, newItem);

      if (value == null) {
        newItem.setText(key + " : null");
        newItem.setImage(nullImage);
      } else if (value instanceof Map) {
        newItem.setText(key);
        newItem.setImage(mapImage);
        drawItem(fieldName, newItem, (Map) value, expand);
      } else if (value instanceof List) {
        newItem.setText(key);
        newItem.setImage(listImage);
        drawItem(fieldName, newItem, (List) value, expand);
      } else {
        setItemInfo(newItem, key, value);
      }

      if (expand) {
        parentItem.setExpanded(expand);
        newItem.setExpanded(expand);
      }
    }
  }
  protected void fillIdMapsTable() {
    // fill user idmaps from plugin.xml
    fillIdMaps(true);

    // fill user idmaps from Preference Store
    fillIdMaps(false);

    // add user idmaps that have ordered entries but no id mappings
    // they do not appear in the preference store with name IDMAP_PREFERENCE_NAME
    Set OrderedKeys = fOrderedElements.keySet();
    Set IdMapKeys = fIdMaps.keySet();
    for (Iterator iter_orderedElements = OrderedKeys.iterator(); iter_orderedElements.hasNext(); ) {
      String IdMapName = (String) iter_orderedElements.next();
      if (!IdMapKeys.contains(IdMapName)) {
        IdMap idmap = new IdMap(IdMapName, false);
        ArrayList idmapOrdered = (ArrayList) fOrderedElements.get(IdMapName);
        setOrdered(idmap, idmapOrdered);
        newIdMapsTableItem(idmap, false);
      }
    }
  }
 private void fillIdMaps(boolean internal) {
   HashMap IdMaps = (internal) ? fIdMapsInternal : fIdMaps;
   HashMap OrderedElements = (internal) ? fOrderedElementsInternal : fOrderedElements;
   Set IdMapKeys = IdMaps.keySet();
   for (Iterator iter_internal = IdMapKeys.iterator(); iter_internal.hasNext(); ) {
     String IdMapName = (String) iter_internal.next();
     Vector Mappings = new Vector();
     IdMap idmap = new IdMap(IdMapName, internal, Mappings);
     // create mappings of internal idmaps
     HashMap idmapHM = (HashMap) IdMaps.get(IdMapName);
     Set idmapKeys = idmapHM.keySet();
     for (Iterator iter_idmap = idmapKeys.iterator(); iter_idmap.hasNext(); ) {
       Mapping mapping = new Mapping();
       String signature = (String) iter_idmap.next();
       int end_of_signature = signature.lastIndexOf(SIGN_SEPARATOR, signature.length() - 2);
       if (end_of_signature < XMLStructureCreator.ROOT_ID.length() + 1)
         mapping.setSignature(""); // $NON-NLS-1$
       else
         mapping.setSignature(
             signature.substring(XMLStructureCreator.ROOT_ID.length() + 1, end_of_signature));
       mapping.setElement(signature.substring(end_of_signature + 1, signature.length() - 1));
       mapping.setIdAttribute((String) idmapHM.get(signature));
       Mappings.add(mapping);
     }
     // create ordered mappings
     ArrayList idmapOrdered = (ArrayList) OrderedElements.get(IdMapName);
     if (idmapOrdered != null) {
       setOrdered(idmap, idmapOrdered);
     }
     // set extension
     if (fIdExtensionToName.containsValue(IdMapName)) {
       Set keySet = fIdExtensionToName.keySet();
       String extension = new String();
       for (Iterator iter = keySet.iterator(); iter.hasNext(); ) {
         extension = (String) iter.next();
         if (((String) fIdExtensionToName.get(extension)).equals(IdMapName)) break;
       }
       idmap.setExtension(extension);
     }
     newIdMapsTableItem(idmap, false);
   }
 }
  protected void saveAuthCache() {
    try {
      this_mon.enter();

      HashMap map = new HashMap();

      Iterator it = auth_cache.values().iterator();

      while (it.hasNext()) {

        authCache value = (authCache) it.next();

        if (value.isPersistent()) {

          try {
            HashMap entry_map = new HashMap();

            entry_map.put("user", value.getAuth().getUserName().getBytes("UTF-8"));
            entry_map.put("pw", new String(value.getAuth().getPassword()).getBytes("UTF-8"));

            map.put(value.getKey(), entry_map);

          } catch (Throwable e) {

            Debug.printStackTrace(e);
          }
        }
      }

      COConfigurationManager.setParameter(CONFIG_PARAM, map);

    } finally {

      this_mon.exit();
    }
  }
Exemplo n.º 29
0
  public void select(VuzeBuddySWT buddy, boolean value, boolean appendSelection) {

    if (null != buddy) {
      for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
        AvatarWidget widget = (AvatarWidget) iterator.next();
        if (true == buddy.equals(widget.getVuzeBuddy())) {
          widget.setSelected(value);
          if (true == appendSelection) {
            break;
          }
        } else if (false == appendSelection) {
          if (true == value) {
            if (widget.isSelected() != false) {
              widget.setSelected(false);
              widget.refreshVisual();
            }
          } else {
            widget.setSelected(false);
            widget.refreshVisual();
          }
        }
      }
    }
    /*
     * De-select all buddies if the given 'buddy' is null
     */
    else {
      for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
        AvatarWidget widget = (AvatarWidget) iterator.next();
        if (true == widget.isSelected()) {
          widget.setSelected(false);
          widget.refreshVisual();
        }
      }
    }
  }