コード例 #1
0
  public void build() {
    getParent().setLayout(new FormLayout());

    Label leftLabel = new Label(getParent(), SWT.NONE);
    leftLabel.setImage(left);
    FormData fdLeftLabel = new FormData();
    leftLabel.setLayoutData(fdLeftLabel);
    fdLeftLabel.left = new FormAttachment(0, 0);
    fdLeftLabel.top = new FormAttachment(0, 0);
    fdLeftLabel.width = left.getBounds().width;
    fdLeftLabel.height = left.getBounds().height;

    Label rightLabel = new Label(getParent(), SWT.NONE);
    rightLabel.setImage(right);
    FormData fdRightLabel = new FormData();
    rightLabel.setLayoutData(fdRightLabel);
    fdRightLabel.right = new FormAttachment(100, 0);
    fdRightLabel.top = new FormAttachment(0, 0);
    fdRightLabel.height = right.getBounds().height;
    fdRightLabel.width = right.getBounds().width;

    footerCenter = new Composite(getParent(), SWT.NONE);
    footerCenter.setBackgroundImage(bg);
    FormData fdFooterCenter = new FormData();
    footerCenter.setLayoutData(fdFooterCenter);
    fdFooterCenter.left = new FormAttachment(leftLabel);
    fdFooterCenter.right = new FormAttachment(rightLabel);
    fdFooterCenter.top = new FormAttachment(0, 0);
    fdFooterCenter.height = bg.getBounds().height;
  }
コード例 #2
0
 /* (non-Javadoc)
  * @see org.nightlabs.eclipse.ui.fckeditor.file.ContentFileBasePage#applySourceFile()
  */
 @Override
 protected void applySourceFile() {
   super.applySourceFile();
   if (getSourceFile() != null && imageLabel != null) {
     imageLabel.setImage(null);
     if (previewImage != null) {
       previewImage.dispose();
       previewImage = null;
     }
     try {
       ImageData id = ImageUtil.loadImage(getSourceFile(), new NullProgressMonitor());
       // ImageData id = new ImageData(new FileInputStream(getSourceFile()));
       float m = Math.max(id.width / 200f, id.height / 200f);
       int width = Math.round(id.width / m);
       int height = Math.round(id.height / m);
       previewImage = new Image(getShell().getDisplay(), id.scaledTo(width, height));
       imageLabel.setImage(previewImage);
       if (!disposeListenerRegistered) {
         getShell().addDisposeListener(this);
         disposeListenerRegistered = true;
       }
     } catch (Exception e) {
       Activator.err("Error loading image preview", e); // $NON-NLS-1$
       previewImage = null;
       imageLabel.setText(
           Messages.getString(
               "org.nightlabs.eclipse.ui.fckeditor.file.image.ContentImageFileBasePage.previewLoadingErrorText")); //$NON-NLS-1$
     }
   }
 }
コード例 #3
0
ファイル: MainUI.java プロジェクト: gongnaixiao/Study
  private Composite createWinStatusBar(Composite composite) {
    Composite winStatusbar = new Composite(composite, SWT.NONE);
    winStatusbar.setLayoutData(new RowData(850, 25));

    Label smlIconLabel = new Label(winStatusbar, SWT.NONE);
    smlIconLabel.setBounds(565, 7, 16, 16);
    smlIconLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/icon_sml.png"));

    CLabel smlLabel = new CLabel(winStatusbar, SWT.NONE);
    smlLabel.setForeground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    smlLabel.setBounds(585, 5, 67, 20);
    smlLabel.setText("软件小助手");

    Label settingIconLabel = new Label(winStatusbar, SWT.NONE);
    settingIconLabel.setBounds(655, 7, 16, 16);
    settingIconLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/setting.png"));

    CLabel lsettingLbel = new CLabel(winStatusbar, SWT.NONE);
    lsettingLbel.setForeground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    lsettingLbel.setBounds(668, 5, 30, 20);
    lsettingLbel.setText("设置");

    Label downloadMgrIconLabel = new Label(winStatusbar, SWT.NONE);
    downloadMgrIconLabel.setBounds(705, 5, 16, 16);
    downloadMgrIconLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/downloadMgr.png"));

    CLabel downloadMgrLabel = new CLabel(winStatusbar, SWT.NONE);
    downloadMgrLabel.setForeground(
        SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    downloadMgrLabel.setBounds(725, 5, 117, 20);
    downloadMgrLabel.setText("已下载软件共 10 款");

    return winStatusbar;
  }
コード例 #4
0
 protected void setStatus(IStatus status) {
   if (status == null || status.isOK()) {
     errorLabel.setText("");
     errorImage.setImage(null);
   } else {
     errorLabel.setText(status.getMessage());
     errorLabel.setToolTipText(status.getMessage());
     Image toUse = null;
     switch (status.getSeverity()) {
       case IStatus.WARNING:
         toUse =
             PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
         break;
       case IStatus.ERROR:
         toUse =
             PlatformUI.getWorkbench()
                 .getSharedImages()
                 .getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
         break;
       case IStatus.INFO:
         toUse =
             PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
         break;
     }
     errorImage.setImage(toUse);
     errorImage.setVisible(true);
   }
 }
コード例 #5
0
  private void addButtons() {
    if ((flags & SWT.CLOSE) != 0) {
      closeButton = new Label(composite, SWT.NONE);
      closeButton.setSize(getHeight(), getHeight());
      closeButton.setImage(closeImage);

      closeButton.addListener(SWT.MouseUp, buttonListener);
      closeButton.addListener(SWT.MouseEnter, buttonListener);
      closeButton.addListener(SWT.MouseExit, buttonListener);
    }

    if ((flags & SWT.MIN) != 0) {
      minimizeButton = new Label(composite, SWT.PUSH | SWT.FLAT);
      minimizeButton.setSize(getHeight(), getHeight());
      minimizeButton.setImage(minimizeImage);

      minimizeButton.addListener(SWT.MouseUp, buttonListener);
      minimizeButton.addListener(SWT.MouseEnter, buttonListener);
      minimizeButton.addListener(SWT.MouseExit, buttonListener);
    }

    if ((flags & SWT.MAX) != 0) {
      restoreButton = new Label(composite, SWT.PUSH | SWT.FLAT);
      restoreButton.setSize(getHeight(), getHeight());
      restoreButton.setImage(restoreImage);

      restoreButton.addListener(SWT.MouseUp, buttonListener);
      restoreButton.addListener(SWT.MouseEnter, buttonListener);
      restoreButton.addListener(SWT.MouseExit, buttonListener);
    }

    setForeground(new Color(Display.getDefault(), 40, 40, 40));
    setBackground(new Color(Display.getDefault(), 140, 140, 140));
  }
コード例 #6
0
ファイル: CommitEditorPage.java プロジェクト: stefanlay/egit
  private Composite createUserArea(
      Composite parent, FormToolkit toolkit, PersonIdent person, boolean author) {
    Composite userArea = toolkit.createComposite(parent);
    GridLayoutFactory.fillDefaults().spacing(2, 2).numColumns(3).applyTo(userArea);

    Label userLabel = toolkit.createLabel(userArea, null);
    userLabel.setImage(getImage(author ? UIIcons.ELCL16_AUTHOR : UIIcons.ELCL16_COMMITTER));
    if (author) userLabel.setToolTipText(UIText.CommitEditorPage_TooltipAuthor);
    else userLabel.setToolTipText(UIText.CommitEditorPage_TooltipCommitter);

    boolean signedOff = isSignedOffBy(person);

    Text userText = new Text(userArea, SWT.FLAT | SWT.READ_ONLY);
    userText.setText(
        MessageFormat.format(
            author ? UIText.CommitEditorPage_LabelAuthor : UIText.CommitEditorPage_LabelCommitter,
            person.getName(),
            person.getEmailAddress(),
            person.getWhen()));
    toolkit.adapt(userText, false, false);
    userText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);

    GridDataFactory.fillDefaults().span(signedOff ? 1 : 2, 1).applyTo(userText);
    if (signedOff) {
      Label signedOffLabel = toolkit.createLabel(userArea, null);
      signedOffLabel.setImage(getImage(UIIcons.SIGNED_OFF));
      if (author) signedOffLabel.setToolTipText(UIText.CommitEditorPage_TooltipSignedOffByAuthor);
      else signedOffLabel.setToolTipText(UIText.CommitEditorPage_TooltipSignedOffByCommitter);
    }

    return userArea;
  }
コード例 #7
0
  private void setSourceRef(String refName) {
    String shortName = Repository.shortenRefName(refName);
    sourceNameLabel.setText(shortName);
    if (refName.startsWith(Constants.R_HEADS) || refName.startsWith(Constants.R_REMOTES))
      sourceIcon.setImage(UIIcons.getImage(resourceManager, UIIcons.BRANCH));
    else if (refName.startsWith(Constants.R_TAGS))
      sourceIcon.setImage(UIIcons.getImage(resourceManager, UIIcons.TAG));
    else sourceIcon.setImage(UIIcons.getImage(resourceManager, UIIcons.CHANGESET));

    sourceRefName = refName;

    suggestBranchName(refName);
    upstreamConfig = UpstreamConfig.getDefault(myRepository, refName);
    checkPage();
  }
コード例 #8
0
ファイル: NewReports.java プロジェクト: edias17/idart-jss
  private void createGrpMandEReports() {
    grpMandEReports = new Group(getShell(), SWT.NONE);
    grpMandEReports.setBounds(new Rectangle(475, 305, 325, 200));
    grpMandEReports.setText(Messages.getString("NewReports.section.m_and_e")); // $NON-NLS-1$
    grpMandEReports.setFont(ResourceUtils.getFont(iDartFont.VERASANS_12));

    lblPicMandEReports = new Label(grpMandEReports, SWT.NONE);
    lblPicMandEReports.setBounds(new org.eclipse.swt.graphics.Rectangle(10, 0, 50, 43));
    lblPicMandEReports.setImage(ResourceUtils.getImage(iDartImage.REPORT_STOCKCONTROLPERCLINIC));

    tblMandEReports = new Table(grpMandEReports, SWT.BORDER);
    tblMandEReports.setBounds(new Rectangle(20, 50, 285, 130));
    tblMandEReports.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));

    TableColumn tblColReportsAvailable = new TableColumn(tblMandEReports, SWT.NONE);
    tblColReportsAvailable.setWidth(270);
    tblColReportsAvailable.setText(Messages.getString("NewReports.table.title")); // $NON-NLS-1$

    tblMandEReports.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseDown(MouseEvent event) {
            clearSelections();
            // Determine where the mouse was clicked
            Point pt = new Point(event.x, event.y);

            // Determine which row was selected
            final TableItem item = tblMandEReports.getItem(pt);
            if (item != null) {
              launchReport(item);
              tblMandEReports.select(tblMandEReports.indexOf(item));
            }
          }
        });
  }
コード例 #9
0
 public void observe(nsIConsoleMessage message) {
   nsIScriptError error =
       (nsIScriptError) message.queryInterface(nsIScriptError.NS_ISCRIPTERROR_IID);
   if (error == null) {
     return;
   }
   if (browser == null || browser.isDisposed()) {
     return;
   }
   long flag = error.getFlags();
   if ((flag == nsIScriptError.errorFlag || flag == nsIScriptError.exceptionFlag)
       && error.getSourceName().equals(internalGetUrl())) {
     errorCount++;
     if (errorCount == 1) {
       String errorMessage =
           MessageFormat.format(
               Messages.getString("FirefoxBrowser.Error"),
               new Object[] {errorCount}); // $NON-NLS-1$
       errorIcon.setImage(Activator.getDefault().getImage(Activator.ERRORS_IMG_ID));
       errorLabel.setText(errorMessage);
       errorLabel.setToolTipText(
           Messages.getString("FirefoxBrowser.Errors_In_Page")); // $NON-NLS-1$
       errorIcon.setToolTipText(errorLabel.getToolTipText());
     } else {
       String errorMessage =
           MessageFormat.format(
               Messages.getString("FirefoxBrowser.Errors"),
               new Object[] {errorCount}); // $NON-NLS-1$
       errorLabel.setText(errorMessage);
     }
     errors.layout(true, true);
     errors.getParent().layout(true, true);
   }
 }
コード例 #10
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("");
          }
        });
  }
コード例 #11
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("");
          }
        });
  }
コード例 #12
0
  private void createWarning(Composite container) {
    warningImg = new Label(container, SWT.CENTER);
    warningLink = new Link(container, SWT.NONE);
    warningLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(warningImg);
    warningImg.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    warningLink.setText(
        "Some selected dependencies can not be resolved. Click <a>here</a> to configure repositories in your settings.xml.");
    warningLink.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            openSettingsRepositoriesWizard();
          }

          private void openSettingsRepositoriesWizard() {
            ConfigureMavenRepositoriesWizard wizard = new ConfigureMavenRepositoriesWizard();
            WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            dialog.create();
            dialog.open();
          }

          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }
        });
  }
コード例 #13
0
    /**
     * Validates the entered file name.
     *
     * @return <tt>true</tt> if the entered file name is valid
     */
    boolean validate() {

      // check if agent is loaded
      String message = Util.ZERO_LENGTH_STRING;
      Image image = null;
      if (!isAgentLoaded) {
        message = Messages.transferingHprofFileNotSupportedMsg;
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
      }

      // check if text is empty
      String newText = fileNameField.getText();
      if (newText.isEmpty()) {
        message = Messages.fileNameEmptyMsg;
        image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
      }

      // check if invalid characters are contained
      for (char c : INVALID_CHARACTERS) {
        if (fileNameField.getText().indexOf(c) != -1) {
          message = Messages.pathContainsInvalidCharactersMsg;
          image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
          break;
        }
      }

      imageLabel.setImage(image);
      messageLabel.setText(message);

      getButton(IDialogConstants.OK_ID).setEnabled(message.isEmpty());
      return true;
    }
コード例 #14
0
  /*
   * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createButtonBar(Composite parent) {
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    Composite buttonBar = new Composite(parent, SWT.NONE);
    buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    buttonBar.setLayout(layout);

    /* Info Container */
    Composite infoContainer = new Composite(buttonBar, SWT.None);
    infoContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    infoContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
    ((GridLayout) infoContainer.getLayout()).marginRight = 10;

    Label infoImg = new Label(infoContainer, SWT.NONE);
    infoImg.setImage(OwlUI.getImage(fResources, "icons/obj16/info.gif")); // $NON-NLS-1$
    infoImg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    Label infoText = new Label(infoContainer, SWT.WRAP);
    infoText.setText(Messages.CustomizeToolbarDialog_USE_MOUSE_INFO);
    infoText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    applyDialogFont(infoContainer);

    /* Create Ok / Cancel Buttons */
    createButtonsForButtonBar(buttonBar);

    return buttonBar;
  }
コード例 #15
0
ファイル: ImageFactory.java プロジェクト: andreyvit/groovy
  /**
   * Add image to a widget or window
   *
   * @param parent
   * @param image
   * @throws JellyTagException
   */
  protected void setImage(Object parent, Image image) throws GroovyException {
    if (parent instanceof Label) {
      Label label = (Label) parent;
      label.setImage(image);

    } else if (parent instanceof Button) {
      Button button = (Button) parent;
      button.setImage(image);

    } else if (parent instanceof Item) {
      Item item = (Item) parent;
      item.setImage(image);

    } else if (parent instanceof Decorations) {
      Decorations item = (Decorations) parent;
      item.setImage(image);

    } else if (parent instanceof Form) {
      Form form = (Form) parent;
      form.setBackgroundImage(image);

    } else if (parent instanceof ScrolledForm) {
      ScrolledForm form = (ScrolledForm) parent;
      form.setBackgroundImage(image);

    } else if (parent instanceof Window) {
      Window window = (Window) parent;
      window.getShell().setImage(image);

    } else {
      throw new GroovyException("This tag must be nested inside a <label>, <button> or <item> tag");
    }
  }
コード例 #16
0
  /** @param form2 */
  private Composite getPageHeader(Composite parent) {
    final Composite header = new Composite(parent, SWT.FILL);
    final FormLayout layout = new FormLayout();
    layout.marginHeight = 5;
    layout.marginWidth = 5;
    header.setLayout(layout);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(header);

    header.setBackground(parent.getBackground());

    final Label titleImage = new Label(header, SWT.FILL);
    final ImageDescriptor imageDescriptor =
        ImageDescriptor.createFromURL(
            Activator.getDefault().getBundle().getResource("icons/view.png")); // $NON-NLS-1$
    titleImage.setImage(new Image(parent.getDisplay(), imageDescriptor.getImageData()));
    final FormData titleImageData = new FormData();
    final int imageOffset = -titleImage.computeSize(SWT.DEFAULT, SWT.DEFAULT).y / 2;
    titleImageData.top = new FormAttachment(50, imageOffset);
    titleImageData.left = new FormAttachment(0, 10);
    titleImage.setLayoutData(titleImageData);

    final Label title = new Label(header, SWT.WRAP);
    title.setText("View Editor"); // $NON-NLS-1$
    titleFont = new Font(title.getDisplay(), getDefaultFontName(title), 12, SWT.BOLD);
    title.setFont(titleFont);
    title.setForeground(getTitleColor(parent));
    final FormData titleData = new FormData();
    title.setLayoutData(titleData);
    titleData.left = new FormAttachment(titleImage, 5, SWT.DEFAULT);

    return header;
  }
コード例 #17
0
  private void createLabel(Composite c, int span, String content, Image image, LabelAttributes la) {
    if (content == null && image == null) return;

    Label l = new Label(c, la.getFontStyle());
    GridData gd = new GridData();
    gd.verticalSpan = span;
    gd.horizontalIndent = 5;
    if (content != null) l.setText(content);

    if (image != null) l.setImage(image);
    if (la.getForegroundColor() != null)
      l.setForeground(new Color(DisplayManager.getDefaultDisplay(), la.getForegroundColor()));

    Font initialFont = l.getFont();
    FontData[] fontData = initialFont.getFontData();
    for (int i = 0; i < fontData.length; i++) {
      fontData[i].setHeight(la.getFontSize());
      fontData[i].setStyle(la.getFontStyle());
    }
    Font newFont = new Font(DisplayManager.getDefaultDisplay(), fontData[0]);
    l.setFont(newFont);
    l.pack();

    l.setBackground(c.getBackground());
    l.setLayoutData(gd);
  }
コード例 #18
0
ファイル: ListItem.java プロジェクト: freimair/photofiler
  public ListItem(Composite parent, int style, Item current) {
    super(parent, style | SWT.TRANSPARENT);
    myObject = current;
    this.setLayout(new GridLayout(2, false));

    iconLabel = new Label(this, SWT.CENTER);
    iconLabel.setImage(Display.getCurrent().getSystemImage(SWT.ICON_WORKING));
    getDisplay()
        .asyncExec(
            new Runnable() {
              @Override
              public void run() {
                if (null == iconLabel || iconLabel.isDisposed()) return;
                iconLabel.setImage(myObject.getThumbnail());
                iconLabel.redraw();
              }
            });

    iconLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    iconLabel.setLayoutData(new GridData(100, 100));
    // nameLabel = new Label(this, SWT.NONE);
    // nameLabel.setText(current.getName());
    // nameLabel.setBackground(Display.getCurrent().getSystemColor(
    // SWT.COLOR_LIST_BACKGROUND));
    setSelected(false);
    this.layout();
  }
コード例 #19
0
ファイル: MainUI.java プロジェクト: gongnaixiao/Study
  private Composite createWinToolBar(Composite composite) {
    Composite winToolbar = new Composite(composite, SWT.NONE);
    winToolbar.setLayoutData(new RowData(850, 88));

    TabButton button1 =
        new TabButton(winToolbar, SWT.NONE, true, "/res/tab_button_SoftCenter.png", 3, null, this);
    button1.setBounds(20, 0, 74, 82);
    TabButton button2 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_AppCenter.png", 3, null, this);
    button2.setBounds(20 + 74 + 5, 0, 74, 82);
    TabButton button3 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_GameCenter.png", 3, null, this);
    button3.setBounds(20 + 74 * 2 + 5, 0, 74, 82);
    TabButton button4 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_Update.png", 3, null, this);
    button4.setBounds(20 + 74 * 3 + 5, 0, 74, 82);
    TabButton button5 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_Uninstall.png", 3, null, this);
    button5.setBounds(20 + 74 * 4 + 5, 0, 74, 82);
    TabButton button6 =
        new TabButton(
            winToolbar, SWT.NONE, false, "/res/tab_button_StartupAccelerate.png", 3, null, this);
    button6.setBounds(20 + 74 * 5 + 5, 0, 74, 82);
    TabButton button7 =
        new TabButton(
            winToolbar, SWT.NONE, false, "/res/tab_button_MobileEssential.png", 3, null, this);
    button7.setBounds(20 + 74 * 6 + 5, 0, 74, 82);

    Label logoLabel = new Label(winToolbar, SWT.NONE);
    logoLabel.setBounds(690, 5, 140, 67);
    logoLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/logo.png"));

    return winToolbar;
  }
コード例 #20
0
 public void setMessage(IWizardPage page) {
   String msg = page.getErrorMessage();
   int type = IMessageProvider.ERROR;
   if (msg == null || msg.length() == 0) {
     msg = page.getMessage();
     type = IMessageProvider.NONE;
     if (msg != null && page instanceof IMessageProvider)
       type = ((IMessageProvider) page).getMessageType();
   }
   Image image = null;
   switch (type) {
     case IMessageProvider.INFORMATION:
       image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_INFO);
       break;
     case IMessageProvider.WARNING:
       image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_WARNING);
       break;
     case IMessageProvider.ERROR:
       image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_ERROR);
       break;
   }
   if (msg == null) msg = ""; // $NON-NLS-1$
   fText.setText(escapeAmpersands(msg));
   if (image == null && msg.length() > 0)
     image = RefactoringPluginImages.get(RefactoringPluginImages.IMG_OBJS_REFACTORING_INFO);
   fImage.setImage(image);
 }
コード例 #21
0
ファイル: FileCompileDialog.java プロジェクト: keithkim/cusp
  protected Control createDialogArea(Composite parent) {

    Composite comp = (Composite) super.createDialogArea(parent);
    GridLayout layout = (GridLayout) comp.getLayout();
    layout.numColumns = 2;

    // below copied from IconandMessageDialog or something like that
    Image image = getSWTImage(SWT.ICON_ERROR);

    if (image != null) {
      imageLabel = new Label(comp, SWT.NULL);
      image.setBackground(imageLabel.getBackground());
      imageLabel.setImage(image);
      // addAccessibleListeners(imageLabel, image);
      imageLabel.setLayoutData(new GridData(GridData.GRAB_VERTICAL));
      GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
    }

    GridData data = new GridData();
    data.horizontalIndent = 4;
    Label text = new Label(comp, SWT.NULL);
    text.setLayoutData(data);
    text.setText(message);
    return comp;
  }
コード例 #22
0
 /**
  * Set translator branding image to a Label
  *
  * @param translatorBrandingImage Label that will display the image
  */
 public void setTranslatorBranding(String translatorName, Label translatorBrandingImage) {
   ITranslator translatorObj = getTranslatorByName(translatorName);
   Image brandingImg = translatorObj.getBrandingImg();
   if (brandingImg != null) {
     translatorBrandingImage.setImage(brandingImg);
   }
 }
コード例 #23
0
ファイル: TagItem.java プロジェクト: darvasd/documaison
  public TagItem(Composite parent, int style, int index, Tag tag, TagPanel parentTagPanel) {
    super(parent, style);
    this.tag = tag;
    this.index = index;
    this.parentTagPanel = parentTagPanel;
    FormLayout layout = new FormLayout();
    setLayout(layout);
    imageLabel = new Label(this, SWT.None);
    imageLabel.setImage(image);
    FormData data = new FormData();
    data.left = new FormAttachment(0, 15);
    imageLabel.setLayoutData(data);
    textLabel = new Label(this, SWT.None);
    textLabel.setText(tag.getName());
    int rgb[] = ColorMap.get().getRGB(tag.getColorName());
    if (rgb == null) {
      rgb = ColorMap.get().getRGB("Black");
    }
    unselectedBackground = getBackground();
    textLabel.setForeground(new Color(getDisplay(), rgb[0], rgb[1], rgb[2]));
    data = new FormData();
    data.left = new FormAttachment(imageLabel, 5);
    data.top = new FormAttachment(imageLabel, 0, SWT.CENTER);
    data.right = new FormAttachment(100, 0);
    textLabel.setLayoutData(data);

    imageLabel.addMouseListener(this);
    textLabel.addMouseListener(this);
    addMouseListener(this);
  }
コード例 #24
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IconAndMessageDialog#createMessageArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createLinkControl(messageComposite);

    int indent = convertWidthInCharsToPixels(3);

    fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent);

    fSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null), indent);

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    imageLabel1.setImage(image);
    imageLabel1.setLayoutData(
        new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    final Label label = new Label(warningComposite, SWT.WRAP);
    label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
    label.setFont(warningComposite.getFont());

    fNotSortAllRadio.setDialogFieldListener(
        new IDialogFieldListener() {
          public void dialogFieldChanged(DialogField field) {
            imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
            label.setEnabled(!fNotSortAllRadio.isSelected());
          }
        });
    imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
    label.setEnabled(!fNotSortAllRadio.isSelected());

    return messageComposite;
  }
コード例 #25
0
  @Override
  protected Control createContents(final Composite parent) {
    noDefaultAndApplyButton();
    final Composite panel = new Composite(parent, SWT.NONE);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    panel.setLayout(layout);

    final Label img = new Label(panel, SWT.NONE);
    img.setLayoutData(new GridData(79, SWT.DEFAULT));
    img.setImage(
        ResourceManager.getPluginImage(ErlideUIPlugin.PLUGIN_ID, "icons/full/obj16/erlang058.gif"));

    final Group composite = new Group(panel, SWT.NONE);
    final GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, false, false);
    gd_composite.widthHint = 356;
    composite.setLayoutData(gd_composite);
    composite.setLayout(new GridLayout());

    final Label text = new Label(composite, SWT.NONE);
    text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    text.setToolTipText("Vlad Dumitrescu, Jakob Cederlund and others");
    text.setText(PreferenceMessages.ErlangPreferencePage_2);

    final Label textv = new Label(composite, SWT.NONE);
    textv.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    final String version = ErlangPlugin.getDefault().getCore().getFeatureVersion();
    textv.setText("    version " + version);

    final Link erlideorgLink = new Link(composite, SWT.NONE);
    erlideorgLink.setText(PreferenceMessages.ErlangPreferencePage_3);

    final Link updateLink = new Link(composite, SWT.NONE);
    updateLink.setText(PreferenceMessages.ErlangPreferencePage_4);
    new Label(panel, SWT.NONE);

    final Button reportButton = new Button(panel, SWT.NONE);
    reportButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(
                getShell(), "org.erlide.ui.reporting", null, null);
          }
        });
    reportButton.setText("Report problems");
    new Label(panel, SWT.NONE);

    txtLocalErlangNodes = new Text(panel, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI);
    txtLocalErlangNodes.setText(
        "This machine supports local Erlang nodes with only short names \nbecause of its hostname configuration. \n\nTo enable long names locally, make sure that the machine \nhas a proper FQDN on the network. ");
    final GridData gd_txtLocalErlangNodes = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_txtLocalErlangNodes.widthHint = 339;
    gd_txtLocalErlangNodes.heightHint = 87;
    txtLocalErlangNodes.setLayoutData(gd_txtLocalErlangNodes);
    txtLocalErlangNodes.setVisible(false);

    return panel;
  }
コード例 #26
0
ファイル: ScaledWidgetFactory.java プロジェクト: kthoms/toast
 public void disposeLabelImage(Label label) {
   disposeRegion(label);
   Image image = label.getImage();
   if (image != null) {
     label.setImage(null);
     image.dispose();
   }
 }
コード例 #27
0
 private void clearErrors() {
   errorCount = 0;
   errorIcon.setImage(Activator.getDefault().getImage(Activator.NO_ERRORS_IMG_ID));
   errorLabel.setText(""); // $NON-NLS-1$
   errorLabel.setToolTipText(""); // $NON-NLS-1$
   errorIcon.setToolTipText(Messages.getString("FirefoxBrowser.No_Errors_On_Page")); // $NON-NLS-1$
   errors.layout(true, true);
 }
コード例 #28
0
  public void createDragSourceComposite(Composite parent, IReferenceNodeInfo referenceNodeInfo) {
    // Composite c = new Composite(parent, SWT.BORDER);
    Group c = new Group(parent, SWT.SHADOW_ETCHED_IN);
    GridLayout gl = new GridLayout(2, false);
    gl.marginTop = 1;
    gl.marginBottom = 5;
    gl.marginLeft = 1;
    gl.marginRight = 1;
    gl.marginHeight = 1;
    gl.marginWidth = 1;
    gl.verticalSpacing = 0;
    gl.horizontalSpacing = 0;

    c.setLayout(gl);

    c.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    Label il = new Label(c, SWT.LEFT | SWT.NO_FOCUS);
    il.setImage(resources.getPlatformImage(ISharedImages.IMG_OBJS_INFO_TSK));
    il.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    Label l = new Label(c, SWT.LEFT | SWT.NO_FOCUS);
    l.setText("Drag this area to a target in the tree to quick-link.");
    l.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    c.pack();

    DragSource[] sources =
        new DragSource[] {
          // new DragSource(il, DND.DROP_MOVE | DND.DROP_COPY),
          new DragSource(l, DND.DROP_MOVE | DND.DROP_COPY),
          new DragSource(c, DND.DROP_MOVE | DND.DROP_COPY),
        };

    final ObjRef fParentRef = referenceNodeInfo.getParentRef();
    final String fFeatureName = referenceNodeInfo.getFeatureName();

    for (DragSource source : sources) {
      Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
      source.setTransfer(types);
      source.addDragListener(
          new DragSourceListener() {
            @Override
            public void dragStart(DragSourceEvent event) {
              event.doit = true;
            }

            @Override
            public void dragSetData(DragSourceEvent event) {
              if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
                event.data = "$LINK$" + fFeatureName + "$" + xarch.getXPath(fParentRef);
              }
            }

            @Override
            public void dragFinished(DragSourceEvent event) {
              if (event.detail == DND.DROP_MOVE) {}
            }
          });
    }
  }
コード例 #29
0
 private void updateInput() {
   if (fInfoText == null || !fInputChanged) {
     return;
   }
   if (fLabelProvider == null) {
     fLabelProvider =
         new RLabelProvider(
             RLabelProvider.LONG | RLabelProvider.HEADER | RLabelProvider.NAMESPACE);
   }
   if (fInput != null) {
     final Image image = fLabelProvider.getImage(fInput.element);
     fTitleImage.setImage(
         (image != null)
             ? image
             : SharedUIResources.getImages().get(SharedUIResources.PLACEHOLDER_IMAGE_ID));
     final StyledString styleString =
         fLabelProvider.getStyledText(
             fInput.element, fInput.element.getElementName(), fInput.elementAttr);
     fTitleText.setText(styleString.getString());
     fTitleText.setStyleRanges(styleString.getStyleRanges());
     if (fInput.detailTitle != null) {
       fInfoText.setText(
           fInput.detailTitle
               + '\n'
               + ((fInput.detailInfo != null) ? fInput.detailInfo : "")); // $NON-NLS-1$
       final StyleRange title = new StyleRange(0, fInput.detailTitle.length(), null, null);
       title.underline = true;
       fInfoText.setStyleRange(title);
     } else {
       fInfoText.setText(""); // $NON-NLS-1$
     }
   } else {
     fTitleImage.setImage(
         SharedUIResources.getImages().get(SharedUIResources.PLACEHOLDER_IMAGE_ID));
     fTitleText.setText(""); // $NON-NLS-1$
     fInfoText.setText(""); // $NON-NLS-1$
   }
   if (fMode == MODE_SIMPLE) {
     setStatusText(
         (fInput.control != null && fInput.control.isFocusControl())
             ? InformationDispatchHandler.getTooltipAffordanceString()
             : ""); //$NON-NLS-1$
   }
   fInputChanged = false;
 }
コード例 #30
0
  private void setSourceCommit(RevCommit commit) {
    sourceNameLabel.setText(commit.abbreviate(7).name());
    sourceIcon.setImage(UIIcons.getImage(resourceManager, UIIcons.CHANGESET));

    sourceRefName = commit.name();

    upstreamConfig = UpstreamConfig.NONE;
    checkPage();
  }