Java 类org.eclipse.jface.resource.JFaceResources 实例源码

项目:eZooKeeper    文件:ZnodeModelTextDataEditor.java   
@Override
protected void createContent() {

    FormToolkit toolkit = getToolkit();

    _Text = toolkit.createText(this, "", SWT.BORDER | SWT.SINGLE);
    _Text.setFont(JFaceResources.getTextFont());

    FormData formData = new FormData();
    formData.top = new FormAttachment(0, 0);
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);

    _Text.setLayoutData(formData);

    _Text.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            setDirtyInternal(true);
        }
    });

}
项目:neoscada    文件:ToolBarNavigator.java   
public ToolBarNavigator ( final Composite parent, final int style, final ViewManager viewManager )
{
    this.viewManager = viewManager;
    this.toolbar = new ToolBar ( parent, style );
    this.resourceManager = new LocalResourceManager ( JFaceResources.getResources ( parent.getDisplay () ) );

    this.toolbar.addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            handleDispose ();
        }
    } );

    viewManager.addViewManagerListener ( this );
}
项目:neoscada    文件:ColorUpdater.java   
private void refresh ()
{
    if ( this.color != null )
    {
        // we may not dispose, the manager has to do that
        this.color = null;
    }
    if ( this.activeColor != null )
    {
        this.manager.destroyColor ( this.activeColor );
        this.activeColor = null;
    }

    this.activeColor = JFaceResources.getColorRegistry ().getColorDescriptor ( this.name, this.defaultColor );
    if ( this.activeColor != null )
    {
        this.color = this.manager.createColor ( this.activeColor );
    }
}
项目:pgcodekeeper    文件:SQLEditor.java   
@Override
protected Control createDialogArea(Composite parent) {
    Composite comp = (Composite) super.createDialogArea(parent);
    Text filed = new Text(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
            | SWT.READ_ONLY | SWT.MULTI);
    filed.setText(text);
    filed.setBackground(getShell().getDisplay().getSystemColor(
            SWT.COLOR_LIST_BACKGROUND));
    filed.setFont(JFaceResources.getTextFont());
    PixelConverter pc = new PixelConverter(filed);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = pc.convertWidthInCharsToPixels(80);
    gd.heightHint = pc.convertHeightInCharsToPixels(30);
    filed.setLayoutData(gd);
    return comp;
}
项目:gemoc-studio    文件:BranchEditPart.java   
@Override
protected IFigure createFigure() {
    final LineLayout layout = new LineLayout();
    layout.setHorizontal(true);
    layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT);
    layout.setMinorAlignment(FlowLayout.ALIGN_BOTTOMRIGHT);
    layout.setMinorSpacing(SPACING);
    layout.setMargin(MARGIN);

    FreeformLayer res = new FreeformLayer();
    final Label toolTip = new Label();
    toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    toolTip.setBackgroundColor(ColorConstants.tooltipBackground);
    toolTip.setForegroundColor(ColorConstants.tooltipForeground);
    toolTip.setText(getModel().getTimelineWindow().getProvider().getTextAt(getModel().getBranch()));
    res.setToolTip(toolTip);
    res.setLayoutManager(layout);
    return res;
}
项目:Hydrograph    文件:SourceViewer.java   
private void initializeViewer(IDocument document) {
    fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    setDocument(document);
    installViewerConfiguration();
    setEditable(true);
    Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
    getTextWidget().setFont(font);
    getTextWidget().setData("document",document);
    Control control = getControl();
    GridData data = new GridData(GridData.FILL_BOTH);
    control.setLayoutData(data);
    prependVerifyKeyListener(new VerifyKeyListener() {

        @Override
        public void verifyKey(VerifyEvent event) {
            handleVerifyKeyPressed(event);
        }
    });
    addDocumentListener(document);
}
项目:solidity-ide    文件:CustomCSSHelpHoverProvider.java   
protected String getStyleSheet() {
    if (fgStyleSheet == null)
        fgStyleSheet = loadStyleSheet();
    String css = fgStyleSheet;
    if (css != null) {
        FontData fontData = JFaceResources.getFontRegistry().getFontData(
                fontSymbolicName)[0];
        css = HTMLPrinter.convertTopLevelFont(css, fontData);
    }
    return css;
}
项目:termsuite-ui    文件:ViewSettingsDialog.java   
@Override
   protected void createButtonsForButtonBar(Composite parent) {
    parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createButton(parent, DEFAULTS_BUTTON_ID, JFaceResources.getString("defaults"), false); //$NON-NLS-1$

    Label l = new Label(parent, SWT.NONE);
    l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    l = new Label(parent, SWT.NONE);
    l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    GridLayout layout = (GridLayout) parent.getLayout();
    layout.numColumns += 2;
    layout.makeColumnsEqualWidth = false;

    super.createButtonsForButtonBar(parent);
}
项目:termsuite-ui    文件:JobInfo.java   
@Override
public Image getDisplayImage() {
       int done = getPercentDone();
       if (done > 0) {
           return super.getDisplayImage();
       }
       if (isBlocked()) {
        return JFaceResources.getImage(ProgressManager.BLOCKED_JOB_KEY);
    }
       int state = getJob().getState();
       if (state == Job.SLEEPING) {
        return JFaceResources.getImage(ProgressManager.SLEEPING_JOB_KEY);
    }
       if (state == Job.WAITING) {
        return JFaceResources.getImage(ProgressManager.WAITING_JOB_KEY);
    }
       //By default return the first progress image
       return super.getDisplayImage();

   }
项目:termsuite-ui    文件:ProgressInfoItem.java   
/**
 * Set the images in the toolbar based on whether the receiver is finished
 * or not. Also update tooltips if required.
 *
 */
private void updateToolBarValues() {
    if (isCompleted()) {
        actionButton.setImage(JFaceResources
                .getImage(CLEAR_FINISHED_JOB_KEY));
        actionButton.setDisabledImage(JFaceResources
                .getImage(DISABLED_CLEAR_FINISHED_JOB_KEY));
        actionButton
                .setToolTipText(ProgressMessages.NewProgressView_ClearJobToolTip);
    } else {
        actionButton.setImage(JFaceResources.getImage(STOP_IMAGE_KEY));
        actionButton.setDisabledImage(JFaceResources
                .getImage(DISABLED_STOP_IMAGE_KEY));

    }
    JobInfo[] infos = getJobInfos();

    for (int i = 0; i < infos.length; i++) {
        // Only disable if there is an unresponsive operation
        if (infos[i].isCanceled() && !isCompleted()) {
            actionButton.setEnabled(false);
            return;
        }
    }
    actionButton.setEnabled(true);
}
项目:termsuite-ui    文件:ProgressInfoItem.java   
/**
 * Set the color base on the index
 *
 * @param i
 */
public void setColor(int i) {
    currentIndex = i;

    if (selected) {
        setAllBackgrounds(getDisplay().getSystemColor(
                SWT.COLOR_LIST_SELECTION));
        setAllForegrounds(getDisplay().getSystemColor(
                SWT.COLOR_LIST_SELECTION_TEXT));
        return;
    }

    if (i % 2 == 0) {
        setAllBackgrounds(JFaceResources.getColorRegistry().get(
                DARK_COLOR_KEY));
    } else {
        setAllBackgrounds(getDisplay().getSystemColor(
                SWT.COLOR_LIST_BACKGROUND));
    }
    setAllForegrounds(getDisplay()
            .getSystemColor(SWT.COLOR_LIST_FOREGROUND));
}
项目:DarwinSPL    文件:DwprofileBrowserInformationControl.java   
/**
 * <p>
 * Creates and initializes the text layout used to compute the size hint.
 * </p>
 * 
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] {tabWidth});

    fTextLayout.setText("");
}
项目:DarwinSPL    文件:HyexpressionBrowserInformationControl.java   
/**
 * <p>
 * Creates and initializes the text layout used to compute the size hint.
 * </p>
 * 
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] {tabWidth});

    fTextLayout.setText("");
}
项目:DarwinSPL    文件:HyvalidityformulaBrowserInformationControl.java   
/**
 * <p>
 * Creates and initializes the text layout used to compute the size hint.
 * </p>
 * 
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] {tabWidth});

    fTextLayout.setText("");
}
项目:DarwinSPL    文件:HydatavalueBrowserInformationControl.java   
/**
 * <p>
 * Creates and initializes the text layout used to compute the size hint.
 * </p>
 * 
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] {tabWidth});

    fTextLayout.setText("");
}
项目:DarwinSPL    文件:HymappingBrowserInformationControl.java   
/**
 * <p>
 * Creates and initializes the text layout used to compute the size hint.
 * </p>
 * 
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] {tabWidth});

    fTextLayout.setText("");
}
项目:DarwinSPL    文件:HyconstraintsBrowserInformationControl.java   
/**
 * <p>
 * Creates and initializes the text layout used to compute the size hint.
 * </p>
 * 
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] {tabWidth});

    fTextLayout.setText("");
}
项目:DarwinSPL    文件:HymanifestBrowserInformationControl.java   
/**
 * <p>
 * Creates and initializes the text layout used to compute the size hint.
 * </p>
 * 
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] {tabWidth});

    fTextLayout.setText("");
}
项目:subclipse    文件:SVNOutputConsole.java   
private void initializeStreams() {
    synchronized(document) {
        if (!initialized) {
            commandStream = newOutputStream();
            errorStream = newOutputStream();
            messageStream = newOutputStream();
            // install colors
            commandColor = createColor(SVNUIPlugin.getStandardDisplay(), ISVNUIConstants.PREF_CONSOLE_COMMAND_COLOR);
            commandStream.setColor(commandColor);
            messageColor = createColor(SVNUIPlugin.getStandardDisplay(), ISVNUIConstants.PREF_CONSOLE_MESSAGE_COLOR);
            messageStream.setColor(messageColor);
            errorColor = createColor(SVNUIPlugin.getStandardDisplay(), ISVNUIConstants.PREF_CONSOLE_ERROR_COLOR);
            errorStream.setColor(errorColor);
            // install font
            setFont(JFaceResources.getFontRegistry().get(ISVNUIConstants.PREF_CONSOLE_FONT));
            initialized = true;
        }
    }
}
项目:subclipse    文件:HistoryTableProvider.java   
public Font getFont(Object element) {
    ILogEntry entry = adaptToLogEntry(element);
    if (entry == null)
        return null;
    SVNRevision revision = entry.getRevision();
    SVNRevision currentRevision = getCurrentRevision();
    if (currentRevision != null && currentRevision.equals(revision)) {
        if (currentRevisionFont == null) {
            Font defaultFont = JFaceResources.getDefaultFont();
            FontData[] data = defaultFont.getFontData();
            for (int i = 0; i < data.length; i++) {
                data[i].setStyle(SWT.BOLD);
            }               
            currentRevisionFont = new Font(viewer.getTable().getDisplay(), data);
        }
        return currentRevisionFont;
    }
    return null;
}
项目:javapasswordsafe    文件:PasswordSafeJFace.java   
/**
 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
 */
@Override
protected void configureShell(final Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(PasswordSafeJFace.APP_NAME);
    // in macOS, the icon gets installed into the .app and this lower resolution one
    // just gets in the way.
    if (!System.getProperty("os.name").toLowerCase().contains("mac")) {
        final Image jpwIcon = IOUtils.getImage(PasswordSafeJFace.class,
                "/org/pwsafe/passwordsafeswt/images/cpane.ico"); //$NON-NLS-1$
        newShell.setImage(jpwIcon);
        // provide it for the rest of jpwsafe:
        JFaceResources.getImageRegistry().put(JPW_ICON, jpwIcon);
        Window.setDefaultImage(jpwIcon);
    }
    WidgetPreferences.tuneShell(newShell, getClass());
    startOpeningDialogThread(newShell);
}
项目:tlaplus    文件:DecomposeProofHandler.java   
private void setupActionButton(Button button, NodeRepresentation nodeRep,
        String text) {
    button.setText(text);
    // button.setSize(30, button.getSize().y + 100);
    GridData gridData = new GridData();
    gridData.horizontalIndent = 15;
    gridData.verticalAlignment = SWT.TOP;
    button.setLayoutData(gridData);
    // Change made by LL for NewDecomposeProofHandler on 21 Aug 2014:
    // nodeRep.nodeRepPath() instead of nodeRep is the object
    // that is attached to the button, and whose value is in
    // DecomposeProofButtonListener.object when
    // DecomposeProofButtonListener.widgetSelected is executed as the
    // result of clicking on the button.
    button.addSelectionListener(new DecomposeProofButtonListener(this,
            nodeRep.nodeRepPath(), ACTION));
    button.setFont(JFaceResources.getFontRegistry().get(
            JFaceResources.TEXT_FONT));
    if (text.equals("  ")) {
        button.setEnabled(false);
    }
}
项目:tlaplus    文件:OldDecomposeProofHandler.java   
private void setupActionButton(Button button, NodeRepresentation nodeRep,
        String text) {
    button.setText(text);
    // button.setSize(30, button.getSize().y + 100);
    GridData gridData = new GridData();
    gridData.horizontalIndent = 15;
    gridData.verticalAlignment = SWT.TOP;
    button.setLayoutData(gridData);
    button.addSelectionListener(new DecomposeProofButtonListener(this,
            nodeRep, ACTION));
    button.setFont(JFaceResources.getFontRegistry().get(
            JFaceResources.TEXT_FONT));
    if (text.equals("  ")) {
        button.setEnabled(false);
    }
}
项目:typescript.java    文件:HoverControlCreator.java   
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
    String tooltipAffordanceString = "Press F2 for focus";
    if (BrowserInformationControl.isAvailable(parent)) {
        String font = JFaceResources.DIALOG_FONT;
        BrowserInformationControl iControl = new BrowserInformationControl(
                parent, font, tooltipAffordanceString) {
            /*
             * @see org.eclipse.jface.text.IInformationControlExtension5#
             * getInformationPresenterControlCreator()
             */
            @Override
            public IInformationControlCreator getInformationPresenterControlCreator() {
                return fInformationPresenterControlCreator;
            }
        };
        addLinkListener(iControl);
        return iControl;
    } else {
        return new DefaultInformationControl(parent,
                tooltipAffordanceString);
    }
}
项目:limpet    文件:ApplicationWorkbenchWindowAdvisor.java   
public Control createEmptyWindowContents(Composite parent)
{
  final IWorkbenchWindow window = getWindowConfigurer().getWindow();
  Composite composite = new Composite(parent, SWT.NONE);
  composite.setLayout(new GridLayout(2, false));
  Display display = composite.getDisplay();
  Color bgCol = display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
  composite.setBackground(bgCol);
  Label label = new Label(composite, SWT.WRAP);
  label.setForeground(display
      .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
  label.setBackground(bgCol);
  label.setFont(JFaceResources.getFontRegistry().getBold(
      JFaceResources.DEFAULT_FONT));
  String msg = IDEWorkbenchMessages.IDEWorkbenchAdvisor_noPerspective;
  label.setText(msg);
  ToolBarManager toolBarManager = new ToolBarManager();
  // TODO: should obtain the open perspective action from ActionFactory
  openPerspectiveAction =
      ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(window);
  toolBarManager.add(openPerspectiveAction);
  ToolBar toolBar = toolBarManager.createControl(composite);
  toolBar.setBackground(bgCol);
  return composite;
}
项目:mytourbook    文件:FontFieldEditorExtended.java   
/**
 * Updates the change font button and the previewer to reflect the newly selected font.
 * 
 * @param font
 *            The FontData[] to update with.
 */
private void updateFont(final FontData font[]) {

    FontData[] bestFont = JFaceResources.getFontRegistry().filterData(font, _lblSelectedFont.getDisplay());

    //if we have nothing valid do as best we can
    if (bestFont == null) {
        bestFont = getDefaultFontData();
    }

    //Now cache this value in the receiver
    this.chosenFont = bestFont;

    if (_lblSelectedFont != null) {
        _lblSelectedFont.setText(StringConverter.asString(chosenFont[0]));
    }
    if (_fontPreviewer != null) {
        _fontPreviewer.setFont(bestFont);
    }

    // update font size widget
    final int fontHeight = bestFont[0].getHeight();
    _spinFontSize.setSelection(fontHeight);
}
项目:typescript.java    文件:OptionsConfigurationBlock.java   
protected Button addRadioBox(Composite parent, String label, Key key, String[] values, int indent) {
    ControlData data = new ControlData(key, values);

    // GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    // gd.horizontalSpan = 3;
    // gd.horizontalIndent = indent;

    Button checkBox = new Button(parent, SWT.RADIO);
    checkBox.setFont(JFaceResources.getDialogFont());
    checkBox.setText(label);
    checkBox.setData(data);
    // checkBox.setLayoutData(gd);
    checkBox.addSelectionListener(getSelectionListener());

    makeScrollableCompositeAware(checkBox);

    String currValue = getValue(key);
    checkBox.setSelection(data.getSelection(currValue) == 0);

    fCheckBoxes.add(checkBox);

    return checkBox;
}
项目:typescript.java    文件:OptionsConfigurationBlock.java   
protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels,
        int indent) {
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1);
    gd.horizontalIndent = indent;

    Label labelControl = new Label(parent, SWT.LEFT);
    labelControl.setText(label);

    labelControl.setFont(JFaceResources.getDialogFont());
    labelControl.setLayoutData(gd);

    Combo comboBox = newComboControl(parent, key, values, valueLabels);
    comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    fLabels.put(comboBox, labelControl);

    return comboBox;
}
项目:typescript.java    文件:OptionsConfigurationBlock.java   
protected Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels,
        boolean readOnly) {
    Combo comboBox = new Combo(composite, readOnly ? SWT.READ_ONLY : SWT.NONE);
    comboBox.setItems(valueLabels);
    comboBox.setFont(JFaceResources.getDialogFont());

    makeScrollableCompositeAware(comboBox);

    String currValue = getValue(key);
    if (readOnly) {
        ControlData data = new ControlData(key, values);
        comboBox.setData(data);
        comboBox.addSelectionListener(getSelectionListener());
        comboBox.select(data.getSelection(currValue));
    } else {
        comboBox.setData(key);
        if (currValue != null) {
            comboBox.setText(currValue);
        }
        comboBox.addModifyListener(getTextModifyListener());
    }

    fComboBoxes.add(comboBox);
    return comboBox;
}
项目:mytourbook    文件:WayPointToolTipProvider.java   
@Override
public Composite createToolTipContentArea(final Event event, final Composite parent) {

    if (_hoveredWayPoint == null) {
        // this case should not happen
        return null;
    }

    final Display display = parent.getDisplay();

    _bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
    _fgColor = display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
    _boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);

    return createUI(parent);
}
项目:bts    文件:ScopedPreferenceStore.java   
public void firePropertyChangeEvent(String name, Object oldValue,
        Object newValue) {
    // important: create intermediate array to protect against listeners
    // being added/removed during the notification
    final Object[] list = getListeners();
    if (list.length == 0) {
        return;
    }
    final PropertyChangeEvent event = new PropertyChangeEvent(this, name,
            oldValue, newValue);
    for (int i = 0; i < list.length; i++) {
        final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
        SafeRunner.run(new SafeRunnable(JFaceResources
                .getString("PreferenceStore.changeError")) { //$NON-NLS-1$
                    public void run() {
                        listener.propertyChange(event);
                    }
                });
    }
}
项目:bts    文件:OptionsConfigurationBlock.java   
protected Combo addComboBox(Composite parent, String label, String key, int indent, String[] values,
        String[] valueLabels) {
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1);
    gd.horizontalIndent = indent;

    Label labelControl = new Label(parent, SWT.LEFT);
    labelControl.setFont(JFaceResources.getDialogFont());
    labelControl.setText(label);
    labelControl.setLayoutData(gd);

    Combo comboBox = newComboControl(parent, key, values, valueLabels);
    comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    labels.put(comboBox, labelControl);

    return comboBox;
}
项目:bts    文件:OptionsConfigurationBlock.java   
protected Combo newComboControl(Composite composite, String key, String[] values, String[] valueLabels) {
    ControlData data = new ControlData(key, values);

    Combo comboBox = new Combo(composite, SWT.READ_ONLY);
    comboBox.setItems(valueLabels);
    comboBox.setData(data);
    comboBox.addSelectionListener(getSelectionListener());
    comboBox.setFont(JFaceResources.getDialogFont());
    comboBox.setVisibleItemCount(30);

    makeScrollableCompositeAware(comboBox);

    updateCombo(comboBox);

    comboBoxes.add(comboBox);
    return comboBox;
}
项目:bts    文件:EditorUtils.java   
public static Color colorFromString(String rgbString) {
    if (rgbString != null && rgbString.trim().length() > 0) {
        Color col = JFaceResources.getColorRegistry().get(rgbString);
        try {
            if (col == null) {
                RGB rgb = StringConverter.asRGB(rgbString);
                JFaceResources.getColorRegistry().put(rgbString, rgb);
                col = JFaceResources.getColorRegistry().get(rgbString);
            }
        }
        catch (DataFormatException e) {
            log.error("Corrupt color value: " + rgbString, e);
        }
        return col;
    }
    return null;
}
项目:APICloud-Studio    文件:ThemePreferencePage.java   
@Override
protected void performDefaults()
{
    // Reset the font to what it was originally!
    setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    try
    {
        Theme theme = getTheme();
        theme.loadFromDefaults();
        setTheme(fSelectedTheme);
    }
    catch (Exception e)
    {
        IdeLog.logError(ThemePlugin.getDefault(), e);
    }
    super.performDefaults();
}
项目:JFaceUtils    文件:EnhancedPreferenceDialog.java   
@Override
protected void constrainShellSize() {
    super.constrainShellSize();
    if (Util.isCocoa()) {
        final Tree tree = getTreeViewer().getTree();
        final FontDescriptor treeFontDescriptor = FontDescriptor.createFrom(JFaceResources.getBannerFont()).setStyle(SWT.NORMAL);
        final Font treeFont = treeFontDescriptor.createFont(tree.getDisplay());
        updateTreeFont(treeFont);
        tree.addDisposeListener(new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent e) {
                treeFontDescriptor.destroyFont(treeFont);
            }
        });
    }
}
项目:APICloud-Studio    文件:CustomBrowserInformationControl.java   
/**
 * Creates and initializes the text layout used to compute the size hint.
 * 
 * @since 3.2
 */
private void createTextLayout()
{
    fTextLayout = new TextLayout(fBrowser.getDisplay());

    // Initialize fonts
    String symbolicFontName = fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);

    // Compute and set tab width
    fTextLayout.setText("    "); //$NON-NLS-1$
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] { tabWidth });
    fTextLayout.setText(""); //$NON-NLS-1$
}
项目:PDFReporter-Studio    文件:JRContextPrefStore.java   
@Override
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
    final Object[] finalListeners = getListeners();
    // Do we need to fire an event.
    if (finalListeners.length > 0 && (oldValue == null || !oldValue.equals(newValue))) {
        final PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
        for (int i = 0; i < finalListeners.length; ++i) {
            final IPropertyChangeListener l = (IPropertyChangeListener) finalListeners[i];
            SafeRunnable.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
                        public void run() {
                            l.propertyChange(pe);
                        }
                    });
        }
    }
}
项目:statecharts    文件:XtextDirectEditManager.java   
/**
 * Given a label figure object, this will calculate the correct Font needed
 * to display into screen coordinates, taking into account the current
 * mapmode. This will typically be used by direct edit cell editors that
 * need to display independent of the zoom or any coordinate mapping that is
 * taking place on the drawing surface.
 * 
 * @param label
 *            the label to use for the font calculation
 * @return the <code>Font</code> that is scaled to the screen coordinates.
 *         Note: the returned <code>Font</code> should not be disposed since
 *         it is cached by a common resource manager.
 */
protected Font getScaledFont(IFigure label) {
    Font scaledFont = label.getFont();
    FontData data = scaledFont.getFontData()[0];
    Dimension fontSize = new Dimension(0, MapModeUtil.getMapMode(label).DPtoLP(data.getHeight()));
    label.translateToAbsolute(fontSize);

    if (Math.abs(data.getHeight() - fontSize.height) < 2)
        fontSize.height = data.getHeight();

    try {
        FontDescriptor fontDescriptor = FontDescriptor.createFrom(data);
        cachedFontDescriptors.add(fontDescriptor);
        return getResourceManager().createFont(fontDescriptor);
    } catch (DeviceResourceException e) {
        Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
                "getScaledFont", e); //$NON-NLS-1$
        Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, "getScaledFont", e); //$NON-NLS-1$
    }
    return JFaceResources.getDefaultFont();
}
项目:statecharts    文件:AbstractEditorPropertySection.java   
protected void createHelpWidget(final Composite parent, final Control control, String helpId) {
    final ImageHyperlink helpWidget = toolkit.createImageHyperlink(parent, SWT.CENTER);
    Image defaultImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP);
    helpWidget.setImage(defaultImage);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(helpWidget);
    helpWidget.setToolTipText(JFaceResources.getString(IDialogLabelKeys.HELP_LABEL_KEY));
    helpWidget.addMouseListener(new MouseAdapter() {
        public void mouseDown(MouseEvent e) {
            control.setFocus();
            PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp();
        }
    });
    GridDataFactory.fillDefaults().applyTo(helpWidget);
    helpWidget.setEnabled(true);
    setHelpContext(control, helpId);
}