コード例 #1
0
 private void updateButtonEnablements() {
   CustomizeData custData = getCustTableSelection();
   setDefaultButton.setEnabled(
       xViewerToCustomize
               .getXViewerFactory()
               .getXViewerCustomizations()
               .isCustomizationPersistAvailable()
           && custTable.getViewer().getTree().isFocusControl()
           && custData != null
           && !custData.getName().equals(CustomizeManager.TABLE_DEFAULT_LABEL)
           && !custData.getName().equals(CustomizeManager.CURRENT_LABEL));
   if (custTable.getViewer().getTree().isFocusControl() && custData != null) {
     try {
       setDefaultButton.setText(
           xViewerToCustomize.getCustomizeMgr().isCustomizationUserDefault(custData)
               ? REMOVE_DEFAULT
               : SET_AS_DEFAULT);
     } catch (XViewerException ex) {
       XViewerLog.log(Activator.class, Level.SEVERE, ex);
     }
     setDefaultButton.getParent().layout();
   }
   deleteButton.setEnabled(
       xViewerToCustomize
               .getXViewerFactory()
               .getXViewerCustomizations()
               .isCustomizationPersistAvailable()
           && custTable.getViewer().getTree().isFocusControl()
           && custData != null);
   addItemButton.setEnabled(
       hiddenColTable.getViewer().getTree().isFocusControl() && getHiddenTableSelection() != null);
   removeItemButton.setEnabled(
       visibleColTable.getViewer().getTree().isFocusControl()
           && getVisibleTableSelection() != null);
   renameButton.setEnabled(
       visibleColTable.getViewer().getTree().isFocusControl()
           && getVisibleTableSelection() != null
           && getVisibleTableSelection().size() == 1);
   moveDownButton.setEnabled(
       visibleColTable.getViewer().getTree().isFocusControl()
           && getVisibleTableSelection() != null);
   moveUpButton.setEnabled(
       visibleColTable.getViewer().getTree().isFocusControl()
           && getVisibleTableSelection() != null);
   saveButton.setEnabled(
       xViewerToCustomize.getXViewerFactory().getXViewerCustomizations() != null
           && xViewerToCustomize
               .getXViewerFactory()
               .getXViewerCustomizations()
               .isCustomizationPersistAvailable());
 }
コード例 #2
0
 private void getInput(Control c) {
   if (InInput) {
     return;
   }
   if (klickedCell == null) {
     return;
   }
   XViewerColumn xCol =
       xv.getXViewerFactory()
           .getDefaultXViewerColumn(((XViewerColumn) klickedColumn.getData()).getId());
   if (xCol instanceof ExtendedViewerColumn) {
     ExtendedViewerColumn extendedCol = (ExtendedViewerColumn) xCol;
     CellEditDescriptor ced =
         extendedCol.getCellEditDescriptorMap().get(klickedCell.getElement().getClass());
     if (ced == null || ced.getControl() == null) {
       return;
     }
     InInput = true;
     try {
       converter.getInput(c, ced, klickedCell.getElement());
       xv.refresh(klickedCell.getElement());
     } catch (Exception ex) {
       InInput = false;
     }
     InInput = false;
   }
 }
コード例 #3
0
 private void handleDeleteButton() {
   try {
     CustomizeData custSel = getCustTableSelection();
     if (custSel.getName().equals(CustomizeManager.TABLE_DEFAULT_LABEL)
         || custSel.getName().equals(CustomizeManager.CURRENT_LABEL)) {
       XViewerLib.popup("ERROR", XViewerText.get("error.delete_default"));
       return;
     }
     if (!custSel.isPersonal() && !xViewerToCustomize.getXViewerFactory().isAdmin()) {
       XViewerLib.popup("ERROR", XViewerText.get("error.delete_global"));
       return;
     }
     if (MessageDialog.openConfirm(
         Display.getCurrent().getActiveShell(),
         XViewerText.get("XViewerCustomizeDialog.prompt.delete.title"),
         MessageFormat.format(
             XViewerText.get("XViewerCustomizeDialog.prompt.delete"), custSel.getName()))) {
       xViewerToCustomize.getCustomizeMgr().deleteCustomization(custSel);
       loadCustomizeTable();
       updateButtonEnablements();
     }
   } catch (Exception ex) {
     XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
   }
 }
コード例 #4
0
 /** @return CustomizeData represented by the configuration area */
 private CustomizeData getConfigCustomizeCustData() {
   CustomizeData custData = new CustomizeData();
   custData.resetGuid();
   custData.setNameSpace(xViewerToCustomize.getXViewerFactory().getNamespace());
   custData.getColumnData().setColumns(getConfigCustXViewerColumns());
   custData.getSortingData().setFromXml(sorterText.getText());
   custData
       .getFilterData()
       .setFilterText(filterText.getText(), filterRegExCheckBox.getSelection());
   custData.getColumnFilterData().setFromXml(columnFilterText.getText());
   return custData;
 }
コード例 #5
0
 private void setInput(Control c) {
   if (klickedCell == null) {
     return;
   }
   XViewerColumn xCol =
       xv.getXViewerFactory()
           .getDefaultXViewerColumn(((XViewerColumn) klickedColumn.getData()).getId());
   if (xCol instanceof ExtendedViewerColumn) {
     ExtendedViewerColumn extendedCol = (ExtendedViewerColumn) xCol;
     CellEditDescriptor ced =
         extendedCol.getCellEditDescriptorMap().get(klickedCell.getElement().getClass());
     if (ced == null || ced.getControl() == null) {
       return;
     }
     converter.setInput(c, ced, klickedCell.getElement());
   }
   c.setBounds(klickedCell.getBounds());
 }
コード例 #6
0
 private void handleSaveButton() {
   try {
     List<CustomizeData> custDatas = new ArrayList<CustomizeData>();
     for (CustomizeData custData : xViewerToCustomize.getCustomizeMgr().getSavedCustDatas()) {
       if (custData.isPersonal()) {
         custDatas.add(custData);
       } else if (xViewerToCustomize.getXViewerFactory().isAdmin()) {
         custDatas.add(custData);
       }
     }
     CustomizationDataSelectionDialog diag =
         new CustomizationDataSelectionDialog(xViewerToCustomize, custDatas);
     if (diag.open() == 0) {
       String name = diag.getEnteredName();
       try {
         CustomizeData diagSelectedCustomizeData = diag.getSelectedCustData();
         String diagEnteredNewName = diag.getEnteredName();
         CustomizeData custData = getConfigCustomizeCustData();
         if (diagEnteredNewName != null) {
           custData.setName(name);
           // Set currently selected to newly saved custData
           selectedCustTableCustData = custData;
         } else {
           custData.setName(diagSelectedCustomizeData.getName());
           custData.setGuid(diagSelectedCustomizeData.getGuid());
         }
         custData.setPersonal(!diag.isSaveGlobal());
         xViewerToCustomize.getCustomizeMgr().saveCustomization(custData);
       } catch (Exception ex) {
         XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
       }
     }
     loadCustomizeTable();
   } catch (Exception ex) {
     XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
   }
 }
コード例 #7
0
  @Override
  protected Control createDialogArea(Composite parent) {
    if (getShell() != null) {
      getShell().setText(title);
    }
    parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite comp = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 700;
    comp.setLayoutData(gd);
    GridLayout gridLayout_2 = new GridLayout();
    gridLayout_2.numColumns = 2;
    comp.setLayout(gridLayout_2);

    Label namespaceLabel = new Label(comp, SWT.NONE);
    GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
    gridData.horizontalSpan = 2;
    namespaceLabel.setLayoutData(gridData);
    namespaceLabel.setText(
        MessageFormat.format(
            XViewerText.get("namespace"), xViewerToCustomize.getXViewerFactory().getNamespace()));

    createSelectCustomizationSection(comp);

    // Column Configuration
    Group configureColumnsGroup = new Group(comp, SWT.NONE);
    configureColumnsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
    configureColumnsGroup.setText("Configure Customization");
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = 3;
    gridLayout.marginHeight = 3;
    gridLayout.numColumns = 3;
    configureColumnsGroup.setLayout(gridLayout);

    createHiddenButtonsComposition(configureColumnsGroup);
    createMoveButtons(configureColumnsGroup);
    createVisibleButtonsComposition(configureColumnsGroup);

    gridLayout.numColumns = 3;
    gridLayout.numColumns = 3;

    // Create Sorter and Filter Blocks
    final Composite composite_2 = new Composite(configureColumnsGroup, SWT.NONE);
    composite_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1));
    final GridLayout gridLayout_3 = new GridLayout();
    gridLayout_3.numColumns = 3;
    composite_2.setLayout(gridLayout_3);

    createSorterTextBlock(composite_2);
    createFilterTextBlock(composite_2);
    createColumnFilterTextBlock(composite_2);

    createConfigCustomizationButtonBar(composite_2);

    try {
      loadCustomizeTable();
    } catch (Exception ex) {
      XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
    }
    updateButtonEnablements();

    return comp;
  }