示例#1
0
  /** Creates a new instance of Triggers */
  public Triggers(Composite parent, int style) {
    super(parent, style);
    setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
    final RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.fill = true;
    layout.wrap = false;
    layout.spacing = 0;
    setLayout(layout);
    action =
        new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.YELLOW_SPHERE, "B-Click", true);
    focus = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.BLUE_SPHERE, "Key-Foc", false);
    armed = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.RED_SPHERE, "M-Press", true);
    over = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.GREEN_SPHERE, "M-Enter", false);
    timing = new SpherePanel(this, SWT.DOUBLE_BUFFERED, DemoResources.GRAY_SPHERE, "1-Stop", true);

    /*
     * Add triggers for each sphere, depending on what we want to trigger them.
     */
    TriggerUtility.addEventTrigger(triggerButton, SWT.Selection, action.getAnimator());
    TriggerUtility.addFocusTrigger(triggerButton, focus.getAnimator(), FocusTriggerEvent.IN, true);
    TriggerUtility.addMouseTrigger(triggerButton, armed.getAnimator(), MouseTriggerEvent.PRESS);
    TriggerUtility.addMouseTrigger(
        triggerButton, over.getAnimator(), MouseTriggerEvent.ENTER, true);
    TriggerUtility.addTimingTrigger(
        action.getAnimator(), timing.getAnimator(), TimingTriggerEvent.STOP);
  }
  public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) {
    super(parent, subSetId);
    GridLayout glayout = new GridLayout();
    glayout.marginBottom = 0;
    glayout.marginHeight = 0;

    parent.setLayout(glayout);
    background = new Composite(parent, SWT.NONE);
    background.setData(RWT.CUSTOM_VARIANT, ICSSConstants.COMP_TRANS); // $NON-NLS-1$
    background.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1));
    RowLayout layout = new RowLayout();
    background.setLayout(layout);
    layout.spacing = 4;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = false;
    perspectiveButtonMap = new HashMap<IPerspectiveDescriptor, Button>();
    buttonPerspectiveMap = new HashMap<Button, IPerspectiveDescriptor>();
    buttonList = new ArrayList<Button>();
    perspectiveList = new ArrayList<String>();
    // images
    bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE);
  }
示例#3
0
  /** Create contents of the window. */
  protected void createContents() {
    shell = new Shell(SWT.NO_TRIM | SWT.BORDER);
    shell.setSize(850, 560);
    shell.setLayout(new FillLayout(SWT.HORIZONTAL));
    LayoutUtil.centerShell(Display.getCurrent(), shell);
    Composite composite = new Composite(shell, SWT.NONE);
    composite.setBackgroundImage(SWTResourceManager.getImage(getClass(), "/res/bg.jpg"));
    composite.setBackgroundMode(SWT.INHERIT_FORCE);
    RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
    rowLayout.marginTop = 0;
    rowLayout.marginRight = 0;
    rowLayout.marginLeft = 0;
    rowLayout.spacing = 5;
    composite.setLayout(rowLayout);

    winTitle = createWinTitle(composite);
    winToolbar = createWinToolBar(composite);

    Composite winMainContent = new Composite(composite, SWT.NONE);
    winMainContent.setLayout(new StackLayout());
    winMainContent.setLayoutData(new RowData(850, 407));

    winStatusbar = createWinStatusBar(composite);
    addShellListener(winTitle, winToolbar, winStatusbar);
  }
示例#4
0
 /** @return a pre-initialized RowLayout suitable for option tabs. */
 private RowLayout createRowLayout() {
   RowLayout rowLayout = new RowLayout();
   rowLayout.type = org.eclipse.swt.SWT.VERTICAL;
   rowLayout.spacing = 9;
   rowLayout.marginHeight = 9;
   rowLayout.marginWidth = 11;
   rowLayout.fill = true;
   return rowLayout;
 }
示例#5
0
  /** This method initializes compButtons */
  protected void createCompButtons() {
    compButton = new Composite(getShell(), SWT.NONE);
    compButton.setBounds(new Rectangle(100, 520, 700, 40));
    RowLayout rowLayout = new RowLayout();
    rowLayout.wrap = false;
    rowLayout.pack = false;
    rowLayout.justify = true;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.spacing = 0;
    compButton.setLayout(rowLayout);
    btnIedeaExport = new Button(compButton, SWT.NONE);
    btnIedeaExport.setText(Messages.getString("NewReports.button.export.iedea")); // $NON-NLS-1$
    btnIedeaExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnIedeaExport.setLayoutData(new RowData(200, 30));
    btnIedeaExport.setToolTipText(
        Messages.getString("NewReports.button.export.tooltip.iedea")); // $NON-NLS-1$
    btnIedeaExport.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdIedeaExportsSelected();
          }
        });

    btnDataExport = new Button(compButton, SWT.NONE);
    btnDataExport.setText(Messages.getString("NewReports.button.export")); // $NON-NLS-1$
    btnDataExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnDataExport.setLayoutData(new RowData(200, 30));
    btnDataExport.setToolTipText(
        Messages.getString("NewReports.button.export.tooltip")); // $NON-NLS-1$
    btnDataExport.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdDataExportsSelected();
          }
        });

    btnDataQuality = new Button(compButton, SWT.NONE);
    btnDataQuality.setText(Messages.getString("NewReports.button.dataQuality")); // $NON-NLS-1$
    btnDataQuality.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnDataQuality.setLayoutData(new RowData(200, 30));
    btnDataQuality.setToolTipText(
        Messages.getString("NewReports.button.dataQuality.tooltip")); // $NON-NLS-1$
    btnDataQuality.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdDataQualitySelected();
          }
        });
    compButton.layout();
  }
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 2;
    layout.verticalSpacing = 20;
    Label label = new Label(container, SWT.NULL);
    label.setText("&Nombre del projecto:");

    // TEXT
    nombreProyecto = new Text(container, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    nombreProyecto.setLayoutData(gd);
    nombreProyecto.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            dialogChanged();
          }
        });

    // Combo box
    label = new Label(container, SWT.NULL);
    label.setText("&Dispositivo:");

    board = new Combo(container, SWT.BORDER | SWT.SINGLE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    board.setLayoutData(gd);

    // Radio button
    label = new Label(container, SWT.NULL);
    label.setText(" ");

    group1 = new Group(container, SWT.SHADOW_IN);
    group1.setText("Tipo de proyecto:");
    RowLayout row = new RowLayout(SWT.HORIZONTAL);
    row.marginTop = 10;
    row.marginRight = 20;
    row.marginLeft = 20;
    row.marginBottom = 10;
    row.spacing = 15;
    group1.setLayout(row);
    botonGenerico = new Button(group1, SWT.RADIO);
    botonGenerico.setText("Generico");
    new Button(group1, SWT.RADIO).setText("BareMetal");

    gd = new GridData(GridData.FILL_HORIZONTAL);
    group1.setLayoutData(gd);

    initialize();
    dialogChanged();
    setControl(container);
  }
  /**
   * Create a zoomable nodedisplay decorated with buttons to allow zooming.
   *
   * @param nodedisplay the decorated nodedisplay
   * @param parent parent composite for this new created nodedisplay
   */
  public NodedisplayViewZoomButtons(AbstractNodedisplayView nodedisplay, Composite parent) {

    super(nodedisplay, parent);

    north = new Composite(this, SWT.None);
    north.setLayoutData(new BorderData(BorderLayout.NFIELD));
    final RowLayout layout = new RowLayout();
    layout.spacing = 0;
    layout.center = true;
    north.setLayout(layout);

    font = new Font(Display.getCurrent(), "Monospaced", 12, SWT.BOLD); // $NON-NLS-1$
    // Make buttons as small as possible but identically sized
    minus = new Button(north, SWT.PUSH);
    minus.setText("-"); // $NON-NLS-1$
    minus.setFont(font);
    minus.pack();
    final int min = Math.min(minus.getSize().x, minus.getSize().y);

    addRectangleSizeComp();

    plus = new Button(north, SWT.PUSH);
    plus.setText("+"); // $NON-NLS-1$
    plus.setFont(font);
    plus.pack();
    final int min2 = Math.min(plus.getSize().x, plus.getSize().y);
    final int max = Math.max(min, min2);
    plus.setLayoutData(new RowData(max, max));
    minus.setLayoutData(new RowData(max, max));

    plus.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            setRectangleSize(getRectangleSize() + 1);
          }
        });

    minus.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (getRectangleSize() > 1) {
              setRectangleSize(getRectangleSize() - 1);
            }
          }
        });
  }
  public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) {
    super(parent, subSetId);
    background = new Composite(parent, SWT.NONE);
    background.setData(RWT.CUSTOM_VARIANT, "compTrans"); // $NON-NLS-1$
    RowLayout layout = new RowLayout();
    background.setLayout(layout);
    layout.spacing = 3;
    layout.marginBottom = 0;
    layout.marginTop = 0;

    perspectiveButtonMap = new HashMap();
    buttonPerspectiveMap = new HashMap();
    buttonList = new ArrayList();
    perspectiveList = new ArrayList();
    // images
    left = getImage(ILayoutSetConstants.PERSP_LEFT_ACTIVE);
    right = getImage(ILayoutSetConstants.PERSP_RIGHT_ACTIVE);
    bg = getImage(ILayoutSetConstants.PERSP_BG);
    bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE);
  }
    protected void createButtonBar(Composite parent) {
      parent.setLayout(new GridLayout(1, true));

      Composite buttons = new Composite(parent, SWT.NONE);
      buttons.setBackground(parent.getBackground());

      GridData buttonsData = new GridData(GridData.FILL_BOTH);
      buttonsData.horizontalAlignment = SWT.RIGHT;
      buttons.setLayoutData(buttonsData);

      RowLayout rl = new RowLayout();
      rl.pack = false;
      rl.spacing = 5;
      buttons.setLayout(rl);

      final Button okButton = new Button(buttons, SWT.PUSH);
      okButton.setText("Ok");
      okButton.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
              okPressed();
            }

            public void widgetDefaultSelected(SelectionEvent e) {}
          });

      final Button cancelButton = new Button(buttons, SWT.PUSH);
      cancelButton.setText("Cancel");
      cancelButton.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
              cancelPressed();
            }

            public void widgetDefaultSelected(SelectionEvent e) {}
          });
      if (Display.getCurrent().getDismissalAlignment() == SWT.RIGHT) {
        cancelButton.moveAbove(okButton);
      }
      this.getShell().setDefaultButton(okButton);
    }
  public Composite createPartControl(Composite parent) {
    content = new Composite(parent, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.wrap = true;
    rowLayout.pack = true;
    rowLayout.fill = true;
    rowLayout.justify = false;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.marginLeft = 2;
    rowLayout.marginTop = 2;
    rowLayout.marginRight = 2;
    rowLayout.marginBottom = 2;
    rowLayout.spacing = 3;
    content.setLayout(rowLayout);

    IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
    themeManager.addPropertyChangeListener(themeChangeListener);
    ITheme theme = themeManager.getCurrentTheme();
    setTheme(theme);

    content.addMouseListener(mouseListener);

    return content;
  }
示例#11
0
  /**
   * show one popup menu over the main window
   *
   * @param menu_entry actual entry which should be shown or disposed
   * @param move TRUE if the curser be moved over one entry, otherwise by clicking false
   */
  private void show(String menu_entry, boolean move) {
    Point abs;
    Group popup;
    Rectangle rect, popup_rect = new Rectangle(0, 0, 120, 100);
    TreeNodes node;
    RowLayout l;
    ArrayList<TreeNodes> nodes;
    ArrayList<Composite> comps;

    if (move && m_sMenu.equals("")) {
      return;
    }
    if (!m_sMenu.equals(menu_entry)) {
      if (m_popupShell != null) m_popupShell.dispose();
      popup = m_mRootEntrys.get(menu_entry);
      rect = popup.getBounds();
      m_popupShell = new Shell(m_oTopLevelShell, SWT.NO_TRIM);
      // popup_rect= m_popupShell.getClientArea();
      abs = LayoutLoader.getAbsoluteUseFieldPoint();
      popup_rect.x = m_oMenu.getBounds().x + abs.x + rect.x;
      popup_rect.y = abs.y + rect.y + rect.height;
      l = new RowLayout();
      l.type = SWT.VERTICAL;
      l.pack = false;
      l.marginBottom = 0;
      l.marginHeight = 0;
      l.marginLeft = 0;
      l.marginRight = 0;
      l.marginTop = 0;
      l.marginWidth = 0;
      l.spacing = 0;
      m_popupShell.setLayout(l);
      node = m_mRootNodes.get(menu_entry);
      nodes = node.getChilds();
      m_sMenu = menu_entry;
      if (nodes.size() == 0) {
        m_sMenu = "";
        return;
      }
      comps = new ArrayList<Composite>();
      for (TreeNodes subnode : nodes) {
        RowLayout layout = new RowLayout();
        Composite comp = new Group(m_popupShell, SWT.NONE);
        Label text = new Label(comp, SWT.NONE);
        HashMap<String, String> metablock = subnode.getMetaData();
        String popupspace = metablock.get("popupspace");
        final String entry;
        int space = 20;
        FontObject font = new FontObject();
        int popupsize = 0;
        boolean bold = false;
        boolean italic = false;
        String looks, ssize;
        MouseListener listener1, listener2;

        entry = m_sMenu + "/" + subnode.getName();
        ssize = metablock.get("popupfontsize");
        if (ssize != null) popupsize = Integer.parseInt(ssize);
        looks = metablock.get("popupstyle");
        if (looks != null) {
          String[] split;

          split = looks.split(",");
          for (int i = 0; i < split.length; ++i) {
            split[i] = split[i].trim().toLowerCase();
            if (split[i].equals("bold")) bold = true;
            else if (split[i].equals("italic")) italic = true;
          }
        }
        font.defineColor(popup, metablock.get("popupcolor"), colors.WIDGET, entry + " popup");
        font.defineColor(popup, metablock.get("popupfontcolor"), colors.TEXT, entry + " popup");
        font.defineFont(
            popup, metablock.get("popupfont"), popupsize, bold, italic, /*underline*/ false);
        text.setText(subnode.getTitle().trim());
        if (popupspace != null) space = Integer.parseInt(popupspace);
        layout.type = SWT.VERTICAL;
        layout.marginTop = space;
        layout.marginRight = space;
        layout.marginBottom = space;
        layout.marginLeft = space;
        comp.setLayout(layout);
        font.setDevice(comp);
        font.setDevice(text);
        font.dispose();
        comps.add(comp);
        text.addMouseListener(
            listener1 =
                new MouseAdapter() {
                  public void mouseDown(MouseEvent event) {
                    LayoutLoader loader;
                    Thread t = null;

                    if (HtmTags.lockDebug) {
                      t = Thread.currentThread();
                      System.out.println(t.getName() + " want to setActiveSideVisible of " + entry);
                    }
                    loader = LayoutLoader.instance();
                    loader.m_sAktFolder = entry;
                    synchronized (TreeNodes.m_DISPLAYLOCK) {
                      loader.setCurrentSideVisible(/*inform server by no body*/ true);
                    }
                    m_nPopup = m_popupShell.getBounds();
                    destroyPopupShell();
                    m_sMenu = "";
                  }
                });
        m_aPopupListeners.put(text, listener1);
        comp.addMouseListener(
            listener2 =
                new MouseAdapter() {
                  public void mouseDown(MouseEvent event) {
                    LayoutLoader loader;
                    Thread t = null;

                    if (HtmTags.lockDebug) {
                      t = Thread.currentThread();
                      System.out.println(t.getName() + " want to setActiveSideVisible of " + entry);
                    }
                    loader = LayoutLoader.instance();
                    loader.m_sAktFolder = entry;
                    synchronized (TreeNodes.m_DISPLAYLOCK) {
                      loader.setCurrentSideVisible(/*inform server by no body*/ true);
                    }
                    m_nPopup = m_popupShell.getBounds();
                    destroyPopupShell();
                    m_sMenu = "";
                  }
                });
        m_aPopupListeners.put(comp, listener2);
      }

      if (m_nPopup != null) popup_rect = m_nPopup;
      m_popupShell.setBounds(popup_rect);
      m_popupShell.setEnabled(false);
      m_popupShell.setVisible(false);
      m_popupShell.open();
      m_popupShell.pack();
      m_popupShell.setEnabled(true);
      m_popupShell.setVisible(true);

    } else if (!m_sMenu.equals("") && !move) { // actual popup is the same
      m_popupShell.dispose();
      m_sMenu = "";
    }
  }
  public DesignModeComposite(final Composite parent, boolean showAddressBar) {
    super(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    gridLayout.makeColumnsEqualWidth = false;
    gridLayout.marginTop = -65;
    parent.setLayout(gridLayout);

    // Gets the information for the open design mode view from the previous instance of eclipse. //
    final IEclipsePreferences workPrefs = InstanceScope.INSTANCE.getNode("org.xtext.hipie.ui");

    buttonComposite = new Composite(parent, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 0;
    rowLayout.spacing = 2;
    buttonComposite.setLayout(rowLayout);

    designModeButton = new Button(buttonComposite, SWT.PUSH | SWT.LEFT);
    designModeButton.setText("Design Mode");
    designModeButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            designModeBrowser.execute("DesignMode();");
          }
        });

    syncButton = new Button(buttonComposite, SWT.PUSH | SWT.LEFT);
    syncButton.setText("Sync");
    syncButton.addSelectionListener(
        new SelectionAdapter() {

          // Regenerates the html file from the ddl,databomb and persist strings. //
          @Override
          public void widgetSelected(SelectionEvent e) {
            String getPersistCmd = "return getPersist();";
            String getDdlCmd = "return getDdl();";
            String getDatabombCmd = "return getDatabomb();";

            IEclipsePreferences workPrefs = InstanceScope.INSTANCE.getNode("org.xtext.hipie.ui");

            try {
              String ddl = (String) designModeBrowser.evaluate(getDdlCmd);
              String databomb = (String) designModeBrowser.evaluate(getDatabombCmd);
              String persist = (String) designModeBrowser.evaluate(getPersistCmd);

              if (cleanHtmlUrl == null) {
                cleanHtmlUrl = new URL(workPrefs.get("clean_html_url_design", ""));
              }

              IPath htmlCleanPath = new Path(cleanHtmlUrl.getPath());
              IFile htmlCleanFile = ResourcesPlugin.getWorkspace().getRoot().getFile(htmlCleanPath);

              IPath persistPath = htmlCleanPath.removeFileExtension().addFileExtension("persist");
              FileWriter fw = new FileWriter(persistPath.toOSString());
              fw.write(persist);
              fw.close();

              URL cleanUrl = new URL("platform:/plugin/org.xtext.hipie/vis_files/clean.html");
              InputStream inStreamClean = cleanUrl.openConnection().getInputStream();
              String streamStringHtml = "";
              Scanner scIn = new Scanner(inStreamClean);
              if (scIn.hasNext()) streamStringHtml = scIn.useDelimiter("\\Z").next();
              streamStringHtml = streamStringHtml.replace("%_data_%", databomb);
              streamStringHtml = streamStringHtml.replace("%_ddl_%", ddl);
              streamStringHtml = streamStringHtml.replace("%_persist_%", persist);
              inStreamClean.close();
              FileWriter htmlOut = new FileWriter(htmlCleanFile.getFullPath().toOSString());
              htmlOut.write(streamStringHtml);
              htmlOut.close();
              scIn.close();

              workPrefs.put("clean_html_url_design", cleanHtmlUrl.toString());
            } catch (IOException e1) {
              e1.printStackTrace();
            }

            try {
              ResourcesPlugin.getWorkspace()
                  .getRoot()
                  .refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
            } catch (CoreException e1) {
              e1.printStackTrace();
            }
          }
        });

    String cleanFilePath = workPrefs.get("clean_html_filepath_design", "");

    designModeBrowser = new Browser(parent, SWT.NONE);
    designModeBrowser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    IFile htmlFile =
        ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(cleanFilePath));

    if (htmlFile != null && htmlFile.exists()) {
      setFilepath(htmlFile);
    }
  }
示例#13
0
  public LoginPanel(Shell page, Composite parent) {
    super(parent, SWT.NONE);
    this.shell = page;

    setLayout(new GridLayout());
    // ´´½¨µÇ¼ÇøÓòµÄÓû§±êÇ© Óû§ÃûÊäÈë¿ò ÃÜÂë±êÇ© ÃÜÂëÊäÈë¿ò µÇ¼°´Å¥
    Composite panelTop = new Composite(this, SWT.NONE);
    panelTop.setBackgroundMode(SWT.INHERIT_DEFAULT);

    RowLayout layout = new RowLayout();
    layout.spacing = 40;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = true;
    layout.center = true;

    panelTop.setLayout(layout);

    userText = new Text(panelTop, SWT.BORDER);
    RowData rd = new RowData();
    rd.width = 240;
    userText.setMessage("Õʺš¢Óû§Ãû»òÕßemail");
    userText.setLayoutData(rd);
    userText.setData(RWT.CUSTOM_VARIANT, "loginInput");
    userText.setFocus();

    passwordText = new Text(panelTop, SWT.BORDER | SWT.PASSWORD);
    rd = new RowData();
    rd.width = 220;
    passwordText.setMessage("ÊäÈëµÇ¼ÃÜÂë");
    passwordText.setLayoutData(rd);
    passwordText.setData(RWT.CUSTOM_VARIANT, "loginInput");

    okButton = new Button(panelTop, SWT.PUSH);
    okButton.setData(RWT.CUSTOM_VARIANT, "loginInput");
    rd = new RowData();
    rd.width = 50;
    rd.height = 50;
    okButton.setLayoutData(rd);
    page.setDefaultButton(okButton);
    okButton.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            buttonPressed();
          }
        });

    // ´´½¨±£´æÃÜÂë¹´Ñ¡¿òºÍ±£´æÓû§Ãû¹´Ñ¡¿ò
    Composite panelBottom = new Composite(this, SWT.NONE);

    layout = new RowLayout();
    layout.spacing = 4;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = true;

    panelBottom.setLayout(layout);

    saveIdButton = new Button(panelBottom, SWT.CHECK);
    saveIdButton.setText("±£´æµÇ¼ÕʺÅ");
    saveIdButton.setData(RWT.CUSTOM_VARIANT, "loginCheck");

    savePassButton = new Button(panelBottom, SWT.CHECK);
    savePassButton.setText("±£´æµÇ¼ÃÜÂë");
    savePassButton.setData(RWT.CUSTOM_VARIANT, "loginCheck");

    // cookie save
    String uid = RWT.getSettingStore().getAttribute(COOKIE_UI_USERID);
    if (uid != null && uid.length() > 0) {
      userText.setText(uid);
      saveIdButton.setSelection(true);
    }
    // cookie save
    String psd = RWT.getSettingStore().getAttribute(COOKIE_UI_PASSWORD);
    if (psd != null && psd.length() > 0) {
      passwordText.setText(psd);
      savePassButton.setSelection(true);
    }

    panelTop.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
    panelBottom.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));

    createTooltips();
  }
示例#14
0
  /**
   * Create contents of the wizard.
   *
   * @param parent the parent widget
   */
  @Override
  @SuppressWarnings("unused") // Don't warn about unassigned "new Label(.)": has side-effect
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    setControl(container);
    GridLayout glContainer = new GridLayout(2, false);
    glContainer.marginWidth = 0;
    glContainer.horizontalSpacing = 0;
    glContainer.marginHeight = 0;
    glContainer.verticalSpacing = 0;
    container.setLayout(glContainer);

    ScrolledComposite configurationScrollArea = new ScrolledComposite(container, SWT.V_SCROLL);
    configurationScrollArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2));
    configurationScrollArea.setExpandHorizontal(true);
    configurationScrollArea.setExpandVertical(true);

    mConfigurationArea = new Composite(configurationScrollArea, SWT.NONE);
    GridLayout glConfigurationArea = new GridLayout(3, false);
    glConfigurationArea.horizontalSpacing = 0;
    glConfigurationArea.marginRight = 15;
    glConfigurationArea.marginWidth = 0;
    glConfigurationArea.marginHeight = 0;
    mConfigurationArea.setLayout(glConfigurationArea);

    Label foregroundLabel = new Label(mConfigurationArea, SWT.NONE);
    foregroundLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    foregroundLabel.setText("Foreground:");

    Composite foregroundComposite = new Composite(mConfigurationArea, SWT.NONE);
    foregroundComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout glForegroundComposite = new GridLayout(5, false);
    glForegroundComposite.horizontalSpacing = 0;
    foregroundComposite.setLayout(glForegroundComposite);

    mImageRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mImageRadio.setSelection(false);
    mImageRadio.addSelectionListener(this);
    mImageRadio.setText("Image");

    mClipartRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mClipartRadio.setText("Clipart");
    mClipartRadio.addSelectionListener(this);

    mTextRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mTextRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    mTextRadio.setText("Text");
    mTextRadio.addSelectionListener(this);
    new Label(mConfigurationArea, SWT.NONE);

    mForegroundArea = new Composite(mConfigurationArea, SWT.NONE);
    mForegroundArea.setLayout(new StackLayout());
    mForegroundArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

    mImageForm = new Composite(mForegroundArea, SWT.NONE);
    mImageForm.setLayout(new GridLayout(3, false));

    Label fileLabel = new Label(mImageForm, SWT.NONE);
    fileLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    fileLabel.setText("Image File:");

    mImagePathText = new Text(mImageForm, SWT.BORDER);
    GridData pathLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    pathLayoutData.widthHint = 200;
    mImagePathText.setLayoutData(pathLayoutData);
    mImagePathText.addSelectionListener(this);
    mImagePathText.addModifyListener(this);

    mPickImageButton = new Button(mImageForm, SWT.FLAT);
    mPickImageButton.setText("Browse...");
    mPickImageButton.addSelectionListener(this);

    mClipartForm = new Composite(mForegroundArea, SWT.NONE);
    mClipartForm.setLayout(new GridLayout(2, false));

    mChooseClipart = new Button(mClipartForm, SWT.FLAT);
    mChooseClipart.setText("Choose...");
    mChooseClipart.addSelectionListener(this);

    mClipartPreviewPanel = new Composite(mClipartForm, SWT.NONE);
    RowLayout rlClipartPreviewPanel = new RowLayout(SWT.HORIZONTAL);
    rlClipartPreviewPanel.marginBottom = 0;
    rlClipartPreviewPanel.marginTop = 0;
    rlClipartPreviewPanel.center = true;
    mClipartPreviewPanel.setLayout(rlClipartPreviewPanel);
    mClipartPreviewPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    mTextForm = new Composite(mForegroundArea, SWT.NONE);
    mTextForm.setLayout(new GridLayout(2, false));

    Label textLabel = new Label(mTextForm, SWT.NONE);
    textLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    textLabel.setText("Text:");

    mText = new Text(mTextForm, SWT.BORDER);
    mText.setText("Aa");
    mText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    mText.addModifyListener(this);

    Label fontLabel = new Label(mTextForm, SWT.NONE);
    fontLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    fontLabel.setText("Font:");

    mFontButton = new Button(mTextForm, SWT.FLAT);
    mFontButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
    mFontButton.addSelectionListener(this);
    mFontButton.setText("Choose Font...");
    new Label(mConfigurationArea, SWT.NONE);

    mTrimCheckBox = new Button(mConfigurationArea, SWT.CHECK);
    mTrimCheckBox.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mTrimCheckBox.setSelection(false);
    mTrimCheckBox.setText("Trim Surrounding Blank Space");
    mTrimCheckBox.addSelectionListener(this);
    new Label(mConfigurationArea, SWT.NONE);

    Label paddingLabel = new Label(mConfigurationArea, SWT.NONE);
    paddingLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    paddingLabel.setText("Additional Padding:");
    new Label(mConfigurationArea, SWT.NONE);

    mPaddingSlider = new Slider(mConfigurationArea, SWT.NONE);
    mPaddingSlider.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    // This doesn't work right -- not sure why. For now just use a plain slider
    // and subtract 10 from it to get the real range.
    // mPaddingSlider.setValues(0, -10, 50, 0, 1, 10);
    mPaddingSlider.setSelection(10 + 15);
    mPaddingSlider.addSelectionListener(this);

    mPercentLabel = new Label(mConfigurationArea, SWT.NONE);
    mPercentLabel.setText("  15%"); // Enough available space for -10%

    mScalingLabel = new Label(mConfigurationArea, SWT.NONE);
    mScalingLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mScalingLabel.setText("Foreground Scaling:");

    mScalingComposite = new Composite(mConfigurationArea, SWT.NONE);
    mScalingComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout gl_mScalingComposite = new GridLayout(5, false);
    gl_mScalingComposite.horizontalSpacing = 0;
    mScalingComposite.setLayout(gl_mScalingComposite);

    mCropRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE);
    mCropRadio.setSelection(true);
    mCropRadio.setText("Crop");
    mCropRadio.addSelectionListener(this);

    mCenterRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE);
    mCenterRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
    mCenterRadio.setText("Center");
    mCenterRadio.addSelectionListener(this);

    mShapeLabel = new Label(mConfigurationArea, SWT.NONE);
    mShapeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mShapeLabel.setText("Shape");

    mShapeComposite = new Composite(mConfigurationArea, SWT.NONE);
    mShapeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout gl_mShapeComposite = new GridLayout(5, false);
    gl_mShapeComposite.horizontalSpacing = 0;
    mShapeComposite.setLayout(gl_mShapeComposite);

    mSquareRadio = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE);
    mSquareRadio.setSelection(true);
    mSquareRadio.setText("Square");
    mSquareRadio.addSelectionListener(this);

    mCircleButton = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE);
    mCircleButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
    mCircleButton.setText("Circle");
    mCircleButton.addSelectionListener(this);

    mThemeLabel = new Label(mConfigurationArea, SWT.NONE);
    mThemeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mThemeLabel.setText("Theme");

    mThemeComposite = new Composite(mConfigurationArea, SWT.NONE);
    mThemeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    GridLayout gl_mThemeComposite = new GridLayout(2, false);
    gl_mThemeComposite.horizontalSpacing = 0;
    mThemeComposite.setLayout(gl_mThemeComposite);

    mHoloLightRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE);
    mHoloLightRadio.setText("Holo Light");
    mHoloLightRadio.setSelection(true);
    mHoloLightRadio.addSelectionListener(this);

    mHoloDarkRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE);
    mHoloDarkRadio.setText("Holo Dark");
    mHoloDarkRadio.addSelectionListener(this);

    mBgColorLabel = new Label(mConfigurationArea, SWT.NONE);
    mBgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mBgColorLabel.setText("Background Color:");

    mBgButton = new Button(mConfigurationArea, SWT.FLAT);
    mBgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mBgButton.addSelectionListener(this);
    mBgButton.setAlignment(SWT.CENTER);

    mFgColorLabel = new Label(mConfigurationArea, SWT.NONE);
    mFgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mFgColorLabel.setText("Foreground Color:");

    mFgButton = new Button(mConfigurationArea, SWT.FLAT);
    mFgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mFgButton.setAlignment(SWT.CENTER);
    mFgButton.addSelectionListener(this);

    if (SUPPORT_LAUNCHER_ICON_TYPES) {
      mEffectsLabel = new Label(mConfigurationArea, SWT.NONE);
      mEffectsLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
      mEffectsLabel.setText("Foreground Effects:");

      mEffectsComposite = new Composite(mConfigurationArea, SWT.NONE);
      mEffectsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
      GridLayout gl_mEffectsComposite = new GridLayout(5, false);
      gl_mEffectsComposite.horizontalSpacing = 0;
      mEffectsComposite.setLayout(gl_mEffectsComposite);

      mSimpleRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mSimpleRadio.setSelection(true);
      mSimpleRadio.setText("Simple");
      mSimpleRadio.addSelectionListener(this);

      mFancyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mFancyRadio.setText("Fancy");
      mFancyRadio.addSelectionListener(this);

      mGlossyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mGlossyRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
      mGlossyRadio.setText("Glossy");
      mGlossyRadio.addSelectionListener(this);
    }

    configurationScrollArea.setContent(mConfigurationArea);
    configurationScrollArea.setMinSize(mConfigurationArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Label previewLabel = new Label(container, SWT.NONE);
    previewLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    previewLabel.setText("Preview:");

    mPreviewArea = new Composite(container, SWT.BORDER);

    RowLayout rlPreviewAreaPreviewArea = new RowLayout(SWT.HORIZONTAL);
    rlPreviewAreaPreviewArea.wrap = true;
    rlPreviewAreaPreviewArea.pack = true;
    rlPreviewAreaPreviewArea.center = true;
    rlPreviewAreaPreviewArea.spacing = 0;
    rlPreviewAreaPreviewArea.marginBottom = 0;
    rlPreviewAreaPreviewArea.marginTop = 0;
    rlPreviewAreaPreviewArea.marginRight = 0;
    rlPreviewAreaPreviewArea.marginLeft = 0;
    mPreviewArea.setLayout(rlPreviewAreaPreviewArea);
    GridData gdMPreviewArea = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
    gdMPreviewArea.widthHint = PREVIEW_AREA_WIDTH;
    mPreviewArea.setLayoutData(gdMPreviewArea);

    // Initial color
    Display display = parent.getDisplay();
    // updateColor(display, new RGB(0xa4, 0xc6, 0x39), true /*background*/);
    updateColor(display, new RGB(0xff, 0x00, 0x00), true /*background*/);
    updateColor(display, new RGB(0x00, 0x00, 0x00), false /*background*/);

    // Start out showing the image form
    // mImageRadio.setSelection(true);
    // chooseForegroundTab(mImageRadio, mImageForm);
    // No, start out showing the text, since the user doesn't have to enter anything
    // initially and we still get images
    mTextRadio.setSelection(true);
    chooseForegroundTab(mTextRadio, mTextForm);
    new Label(mConfigurationArea, SWT.NONE);
    new Label(mConfigurationArea, SWT.NONE);
    new Label(mConfigurationArea, SWT.NONE);

    validatePage();
  }
示例#15
0
  private void initIcons(ApplicationFactory factory) {
    Composite center = null;
    if (Application.LICENSE == Install.PERSONAL) {
      center = new Composite(this, SWT.TRANSPARENCY_ALPHA);
      GridData gridData = new GridData(GridData.FILL_BOTH);
      center.setLayoutData(gridData);

      GridLayout gridLayout = new GridLayout(2, false);
      center.setLayout(gridLayout);

      Browser widget = null;

      //      ClientLog.getInstance().setMessage(getShell(), new Exception( "buoc 1 da chay vao day
      // roi " + widget.toString()));

      try {
        widget = new Browser(center, SWT.NONE);
        //        ClientLog.getInstance().setMessage(getShell(), new Exception( " da chay vao day
        // roi " + widget.toString()));
      } catch (Exception e) {
        widget = new Browser(center, SWT.NONE);
        ClientLog.getInstance().setException(null, e);
      }
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.verticalSpan = 2;
      widget.setLayoutData(gridData);
      if (Application.GROUPS.length > 0 && Application.GROUPS[0].equals("XML")) {
        widget.setUrl("http://vietspider.org/webextractor/");
        toolbar.setText("http://vietspider.org/webextractor/");
      } else {
        widget.setUrl("http://nik.vn/tin/");
        //      widget.setUrl("http://*****:*****@SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            BrowserWidget browser = workspace.getTab().createItem();
            browser.viewPage();
          }
        };
    browserImageLink.addHyperlinkListener(listener);
    //    browserLink.addHyperlinkListener(listener);

    composite = createItem(top);
    final ImageHyperlink creatorImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    creatorImageLink.setImage(factory.loadImage("large.createsource.png"));
    //    creatorImageLink.setBackground(getBackground());
    creatorImageLink.setToolTipText(factory.getLabel("creatorLink"));
    //    final Hyperlink creatorLink = createLink(composite);
    //    creatorLink.setText(factory.getLabel("creatorLink"));
    //    creatorLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(false);
            try {
              ChannelWizard wizard =
                  (ChannelWizard)
                      workspace.getTab().createTool(ChannelWizard.class, false, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(null, exp);
            }
            //        try {
            //          Creator creator = (Creator)workspace.getTab().createTool(
            //              Creator.class, false,  SWT.CLOSE);
            //          creator.selectData(new Worker[0], null, null);
            //        } catch (Exception exp) {
            //          ClientLog.getInstance().setException(null, exp);
            //        }
          }
        };
    creatorImageLink.addHyperlinkListener(listener);
    //    creatorLink.addHyperlinkListener(listener);

    ////////////////////////////////////////////////////////////////////////////////////////////////

    Composite bottom = new Composite(center, SWT.TRANSPARENCY_ALPHA);
    if (Application.LICENSE == Install.PERSONAL) {
      gridData = new GridData();
      gridData.widthHint = 350;
    } else {
      gridData = new GridData(GridData.FILL_BOTH);
    }
    bottom.setLayoutData(gridData);
    //    bottom.setBackground(getBackground());

    rowLayout = new RowLayout();
    rowLayout.wrap = true;
    rowLayout.pack = true;
    rowLayout.justify = true;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.marginLeft = 5;
    rowLayout.marginTop = 5;
    rowLayout.marginRight = 5;
    rowLayout.marginBottom = 5;
    rowLayout.spacing = 20;
    bottom.setLayout(rowLayout);

    if (Application.LICENSE != Install.PERSONAL) {
      composite = createItem(top);
    } else {
      composite = createItem(bottom);
    }
    final ImageHyperlink crawlerImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    crawlerImageLink.setImage(factory.loadImage("large.crawler.png"));
    //    crawlerImageLink.setBackground(getBackground());
    crawlerImageLink.setToolTipText(factory.getLabel("crawlerLink"));
    //    final Hyperlink crawlerLink = createLink(composite);
    //    crawlerLink.setText(factory.getLabel("crawlerLink"));
    //    crawlerLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(false);
            try {
              workspace.getTab().createTool(Crawler.class, true, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(getShell(), exp);
            }
          }
        };
    crawlerImageLink.addHyperlinkListener(listener);
    //    crawlerLink.addHyperlinkListener(listener);

    if (Application.LICENSE != Install.PERSONAL) {
      composite = createItem(bottom);
      final ImageHyperlink monitorImageLink =
          new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
      monitorImageLink.setImage(factory.loadImage("large.log.png"));
      //      monitorImageLink.setBackground(getBackground());
      monitorImageLink.setToolTipText(factory.getLabel("logLink"));
      //      final Hyperlink monitorLink = createLink(composite);
      //      monitorLink.setText(factory.getLabel("monitorLink"));
      //      monitorLink.setForeground(color);
      listener =
          new HyperlinkAdapter() {
            @SuppressWarnings("unused")
            public void linkActivated(HyperlinkEvent e) {
              try {
                workspace.getTab().createTool(LogViewer2.class, true, SWT.CLOSE);
              } catch (Exception exp) {
                ClientLog.getInstance().setException(workspace.getShell(), exp);
              }
            }
          };
      monitorImageLink.addHyperlinkListener(listener);
      //      monitorLink.addHyperlinkListener(listener);
    }

    /*if(Application.LICENSE  != Install.PERSONAL) {
          composite = createItem(bottom);
          final ImageHyperlink userImageLink =
            new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
          userImageLink.setImage(factory.loadImage("large.userfolder.png"));
    //      userImageLink.setBackground(getBackground());
          userImageLink.setToolTipText(factory.getLabel("userLink"));
    //      final Hyperlink userLink = createLink(composite);
    //      userLink.setText(factory.getLabel("userLink"));
    //      userLink.setForeground(color);
          listener = new HyperlinkAdapter() {
            @SuppressWarnings("unused")
            public void linkEntered(HyperlinkEvent e) {
    //          userLink.setUnderlined(true);
            }

            @SuppressWarnings("unused")
            public void linkExited(HyperlinkEvent e) {
    //          userLink.setUnderlined(false);
    //          userLink.setFont(UIDATA.FONT_9VB);
            }
            @SuppressWarnings("unused")
            public void linkActivated(HyperlinkEvent e) {
    //          userLink.setUnderlined(false);
              try {
                workspace.getTab().createTool(Organization.class, true,  SWT.CLOSE);
              }catch (Exception exp) {
                ClientLog.getInstance().setException(workspace.getShell(), exp);
              }
            }
          };
          userImageLink.addHyperlinkListener(listener);
    //      userLink.addHyperlinkListener(listener);
        }*/

    composite = createItem(bottom);

    final ImageHyperlink configImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    configImageLink.setImage(factory.loadImage("large.settingsfolder.png"));
    //    configImageLink.setBackground(getBackground());
    configImageLink.setToolTipText(factory.getLabel("configLink"));
    //    final Hyperlink configLink = createLink(composite);
    //    configLink.setText(factory.getLabel("configLink"));
    //    configLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        configLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        configLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        configLink.setUnderlined(false);
            try {
              workspace.getTab().createTool(Config.class, true, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(workspace.getShell(), exp);
            }
          }
        };
    configImageLink.addHyperlinkListener(listener);
  }
示例#16
0
  private Composite createActions(
      final ChangeDetail changeDetail,
      final PatchSetDetail patchSetDetail,
      final PatchSetPublishDetail publishDetail,
      Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.center = true;
    layout.spacing = 10;
    buttonComposite.setLayout(layout);

    boolean canPublish =
        getTaskData()
            .getAttributeMapper()
            .getBooleanValue(
                getTaskData()
                    .getRoot()
                    .getAttribute(GerritTaskSchema.getDefault().CAN_PUBLISH.getKey()));
    boolean canSubmit = false;
    boolean canRebase = false;
    if (changeDetail.getCurrentActions() != null) {
      canSubmit = changeDetail.getCurrentActions().contains(ApprovalCategory.SUBMIT);
    } else if (changeDetail instanceof ChangeDetailX) {
      // Gerrit 2.2 and later
      canSubmit = ((ChangeDetailX) changeDetail).canSubmit();
      canRebase = ((ChangeDetailX) changeDetail).canRebase();
    }

    if (canPublish) {
      Button publishButton = toolkit.createButton(buttonComposite, "Publish Comments...", SWT.PUSH);
      publishButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              doPublish(publishDetail);
            }
          });
    }

    Button fetchButton = toolkit.createButton(buttonComposite, "Fetch...", SWT.PUSH);
    fetchButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            doFetch(changeDetail, patchSetDetail);
          }
        });

    final Composite compareComposite = toolkit.createComposite(buttonComposite);
    GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(compareComposite);

    Button compareButton = toolkit.createButton(compareComposite, "Compare With Base", SWT.PUSH);
    compareButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            doCompareWith(changeDetail, null, patchSetDetail.getPatchSet());
          }
        });

    if (changeDetail.getPatchSets().size() > 1) {
      Button compareWithButton = toolkit.createButton(compareComposite, "", SWT.PUSH);
      GridDataFactory.fillDefaults().grab(false, true).applyTo(compareWithButton);
      compareWithButton.setImage(
          WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_BUTTON_MENU));
      compareWithButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              showCompareMenu(compareComposite, changeDetail, patchSetDetail);
            }

            private void showCompareMenu(
                Composite compareComposite,
                ChangeDetail changeDetail,
                PatchSetDetail patchSetDetail) {
              Menu menu = new Menu(compareComposite);
              Point p = compareComposite.getLocation();
              p.y = p.y + compareComposite.getSize().y;
              p = compareComposite.getParent().toDisplay(p);
              fillCompareWithMenu(changeDetail, patchSetDetail, menu);
              menu.setLocation(p);
              menu.setVisible(true);
            }
          });
    }

    if (canRebase) {
      Button rebaseButton = toolkit.createButton(buttonComposite, "Rebase", SWT.PUSH);
      rebaseButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              doRebase(patchSetDetail.getPatchSet());
            }
          });
    }

    if (canSubmit) {
      Button submitButton = toolkit.createButton(buttonComposite, "Submit", SWT.PUSH);
      submitButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              doSubmit(patchSetDetail.getPatchSet());
            }
          });
    }

    if (changeDetail != null && changeDetail.isCurrentPatchSet(patchSetDetail)) {
      if (changeDetail.canAbandon()) {
        Button abondonButton = toolkit.createButton(buttonComposite, "Abandon...", SWT.PUSH);
        abondonButton.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                doAbandon(patchSetDetail.getPatchSet());
              }
            });
      } else if (changeDetail.canRestore()) {
        Button restoreButton = toolkit.createButton(buttonComposite, "Restore...", SWT.PUSH);
        restoreButton.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                doRestore(patchSetDetail.getPatchSet());
              }
            });
      }
    }
    return buttonComposite;
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    gray = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY);
    black = parent.getDisplay().getSystemColor(SWT.COLOR_BLACK);
    tParent = (Composite) super.createDialogArea(parent);
    tParent.setLayout(new GridLayout(2, false));
    tParent.setLayoutData(new GridData(720, 410));

    Composite c = new Composite(tParent, SWT.BORDER);
    c.setLayout(new GridLayout(2, false));
    c.setLayoutData(new GridData(200, 388));
    Composite c1 = new Composite(c, SWT.NONE);
    c1.setLayout(new GridLayout(1, true));
    c1.setLayoutData(new GridData(150, 380));
    new Label(c1, SWT.NONE).setText("自定义过滤器:");
    initCustomFilterList(c1);

    Composite c2 = new Composite(c, SWT.NONE);
    RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
    rowLayout.marginLeft = 0;
    rowLayout.marginTop = 150;
    rowLayout.spacing = 5;
    c2.setLayout(rowLayout);
    c2.setLayoutData(new GridData(50, 380));
    Button addCustom = new Button(c2, SWT.PUSH);
    addCustom.setText("新增");
    addCustom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // 新增自定义过滤器方法
            if (isChange()) {
              if (!MessageDialog.openConfirm(getShell(), "", "不保存当前内容吗?")) {
                return;
              }
            }
            refresh();
          }
        });
    Button delCustom = new Button(c2, SWT.PUSH);
    delCustom.setText("删除");
    delCustom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // 删除已保存的自定义过滤器方法
            String[] filters = customFilterList.getSelection();
            if (filters != null && filters.length > 0) {
              if (MessageDialog.openConfirm(getShell(), "", "确定要删除选中的自定义过滤器吗?")) {
                deletePreference(filters);
              }
            } else {
              MessageDialog.openInformation(getShell(), "", "请选择要删除的自定义过滤器。");
            }
          }
        });

    Button editCustom = new Button(c2, SWT.PUSH);
    editCustom.setText("编辑");
    editCustom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // 编辑已有的自定义过滤器方法
            edit();
          }
        });

    Composite c3 = new Composite(tParent, SWT.NONE);
    c3.setLayout(new GridLayout(1, true));
    c3.setLayoutData(new GridData(500, 400));

    Composite top = new Composite(c3, SWT.NONE);
    top.setLayout(new GridLayout(2, false));
    new Label(top, SWT.NONE).setText("过滤器名称:");
    filterNameTxt = new Text(top, SWT.BORDER);
    filterNameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    andBtn = new Button(top, SWT.RADIO);
    andBtn.setText("满足所有条件");
    andBtn.setSelection(true);
    orBtn = new Button(top, SWT.RADIO);
    orBtn.setText("满足以下任一条件");
    scroll = new ScrolledComposite(c3, SWT.V_SCROLL | SWT.BORDER);
    scroll.setAlwaysShowScrollBars(true);
    scroll.setLayoutData(new GridData(470, 250));
    scroll.setExpandHorizontal(true);
    scroll.setExpandVertical(true);
    dynaComp = new Composite(scroll, SWT.BORDER);
    scroll.setContent(dynaComp);
    dynaComp.setLayout(new GridLayout(1, true));
    new DynaComposite(dynaComp, SWT.NONE);

    Composite c4 = new Composite(c3, SWT.BORDER);
    c4.setLayout(new GridLayout(2, true));
    c4.setLayoutData(new GridData(470, 60));

    btnIsTagged = new Button(c4, SWT.CHECK);
    btnIsTagged.setText("标记的匹配");
    btnQT = new Button(c4, SWT.CHECK);
    btnQT.setText("快速翻译匹配");
    btnPT = new Button(c4, SWT.CHECK); // propagate translation
    btnPT.setText("自动繁殖翻译匹配");
    if (isTEInstalled()) {
      btnIsRemoveFromSrc = new Button(c4, SWT.CHECK);
      btnIsRemoveFromSrc.setText("从来源中删除");
    }

    return parent;
  }