Esempio n. 1
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);
   }
 }
Esempio n. 2
0
  private void createSorterTextBlock(final Composite composite) {
    final Label sorterLabel = new Label(composite, SWT.NONE);
    sorterLabel.setText("Sorter:");

    sorterText = new Text(composite, SWT.BORDER);
    sorterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label clearSorterLabel = new Label(composite, SWT.PUSH);
    clearSorterLabel.setImage(XViewerLib.getImage("clear.gif"));
    clearSorterLabel.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseDown(MouseEvent e) {
            // do nothing
          }

          @Override
          public void mouseDoubleClick(MouseEvent e) {
            // do nothing

          }

          @Override
          public void mouseUp(MouseEvent e) {
            sorterText.setText("");
          }
        });
  }
Esempio n. 3
0
  private void createColumnFilterTextBlock(final Composite composite) {
    // Filter text block
    final Composite composite_8 = new Composite(composite, SWT.NONE);
    composite_8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1));
    final GridLayout gridLayout_14 = new GridLayout();
    gridLayout_14.numColumns = 3;
    composite_8.setLayout(gridLayout_14);

    final Label columnFilterLabel = new Label(composite_8, SWT.NONE);
    columnFilterLabel.setText("Column Filter:");

    columnFilterText = new Text(composite_8, SWT.BORDER);
    columnFilterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label clearColumnFilterLabel = new Label(composite_8, SWT.PUSH);
    clearColumnFilterLabel.setImage(XViewerLib.getImage("clear.gif"));
    clearColumnFilterLabel.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseDown(MouseEvent e) {
            // do nothing
          }

          @Override
          public void mouseDoubleClick(MouseEvent e) {
            // do nothing
          }

          @Override
          public void mouseUp(MouseEvent e) {
            columnFilterText.setText("");
          }
        });
  }
Esempio n. 4
0
 private void handleSetDefaultButton() {
   try {
     CustomizeData custData = getCustTableSelection();
     if (custData.getName().equals(CustomizeManager.TABLE_DEFAULT_LABEL)
         || custData.getName().equals(CustomizeManager.CURRENT_LABEL)) {
       XViewerLib.popup("ERROR", XViewerText.get("error.set_default"));
       return;
     }
     if (xViewerToCustomize.getCustomizeMgr().isCustomizationUserDefault(custData)) {
       if (MessageDialog.openConfirm(
           Display.getCurrent().getActiveShell(),
           XViewerText.get("button.remove_default"),
           MessageFormat.format(
               XViewerText.get("XViewerCustomizeDialog.prompt.remove_default"),
               custData.getName()))) {
         xViewerToCustomize.getCustomizeMgr().setUserDefaultCustData(custData, false);
       }
     } else if (MessageDialog.openConfirm(
         Display.getCurrent().getActiveShell(),
         XViewerText.get("button.set_default"),
         MessageFormat.format(
             XViewerText.get("XViewerCustomizeDialog.prompt.set_default"), custData.getName()))) {
       xViewerToCustomize.getCustomizeMgr().setUserDefaultCustData(custData, true);
     }
     loadCustomizeTable();
   } catch (Exception ex) {
     XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
   }
 }
Esempio n. 5
0
  private void createFilterTextBlock(final Composite composite) {
    // Filter text block
    final Composite composite_7 = new Composite(composite, SWT.NONE);
    composite_7.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1));
    final GridLayout gridLayout_13 = new GridLayout();
    gridLayout_13.numColumns = 5;
    composite_7.setLayout(gridLayout_13);

    final Label filterLabel = new Label(composite_7, SWT.NONE);
    filterLabel.setText("Filter Text:");

    filterText = new Text(composite_7, SWT.BORDER);
    filterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Label filterLabel2 = new Label(composite_7, SWT.NONE);
    filterLabel2.setText("Regular Expression:");

    filterRegExCheckBox = new Button(composite_7, SWT.CHECK);
    filterRegExCheckBox.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE, false, false));

    final Label clearFilterLabel = new Label(composite_7, SWT.PUSH);
    clearFilterLabel.setImage(XViewerLib.getImage("clear.gif"));
    clearFilterLabel.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseDown(MouseEvent e) {
            // do nothing
          }

          @Override
          public void mouseDoubleClick(MouseEvent e) {
            // do nothing

          }

          @Override
          public void mouseUp(MouseEvent e) {
            filterText.setText("");
          }
        });
  }
 public void open(TreeItem items[], String defaultFilename) {
   try {
     String html = getHtml(items);
     final FileDialog dialog =
         new FileDialog(Display.getCurrent().getActiveShell().getShell(), SWT.SAVE);
     dialog.setFilterExtensions(new String[] {"*.html"}); // $NON-NLS-1$
     if (defaultFilename != null && !defaultFilename.equals("")) { // $NON-NLS-1$
       dialog.setFileName(defaultFilename);
     }
     String filename = dialog.open();
     if (filename == null || filename.equals("")) { // $NON-NLS-1$
       return;
     }
     try {
       XViewerLib.writeStringToFile(html, new File(filename));
     } catch (IOException ex) {
       XViewerLog.log(Activator.class, Level.SEVERE, ex);
       return;
     }
     Program.launch(filename);
   } catch (Exception ex) {
     XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
   }
 }