Example usage for org.eclipse.jface.resource JFaceResources getColorRegistry

List of usage examples for org.eclipse.jface.resource JFaceResources getColorRegistry

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getColorRegistry.

Prototype

public static ColorRegistry getColorRegistry() 

Source Link

Document

Returns the color registry for JFace itself.

Usage

From source file:org.eclipse.cdt.ui.newui.NewConfigurationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create a group for the name & description

    final Group group1 = new Group(composite, SWT.NONE);
    group1.setFont(composite.getFont());
    GridLayout layout1 = new GridLayout(3, false);
    group1.setLayout(layout1);//from  w  w  w . j a  v  a 2 s  .  c  o m
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group1.setLayoutData(gd);

    // bug 187634: Add a label to warn user that configuration name will be used directly
    // as a directory name in the filesystem.
    Label warningLabel = new Label(group1, SWT.BEGINNING | SWT.WRAP);
    warningLabel.setFont(parent.getFont());
    warningLabel.setText(Messages.NewConfiguration_label_warning);
    gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1);
    gd.widthHint = 300;
    warningLabel.setLayoutData(gd);

    // Add a label and a text widget for Configuration's name
    final Label nameLabel = new Label(group1, SWT.LEFT);
    nameLabel.setFont(parent.getFont());
    nameLabel.setText(Messages.NewConfiguration_label_name);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);

    configName = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configName.setFont(group1.getFont());
    configName.setText(getNewName());
    configName.setFocus();
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configName.setLayoutData(gd);
    configName.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateState();
        }
    });

    //       Add a label and a text widget for Configuration's description
    final Label descriptionLabel = new Label(group1, SWT.LEFT);
    descriptionLabel.setFont(parent.getFont());
    descriptionLabel.setText(Messages.NewConfiguration_label_description);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    descriptionLabel.setLayoutData(gd);
    configDescription = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configDescription.setFont(group1.getFont());
    configDescription.setText(getNewDescription());
    configDescription.setFocus();

    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configDescription.setLayoutData(gd);

    final Group group = new Group(composite, SWT.NONE);
    group.setFont(composite.getFont());
    group.setText(Messages.NewConfiguration_label_group);
    GridLayout layout = new GridLayout(1, false);
    group.setLayout(layout);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group.setLayoutData(gd);

    cloneConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    cloneConfigSelector.setFont(group.getFont());
    cloneConfigSelector.setItems(getDefinedConfigNamesAndDescriptions());
    int index = cloneConfigSelector.indexOf(newName);
    cloneConfigSelector.select(index < 0 ? 0 : index);
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    cloneConfigSelector.setLayoutData(gd);
    cloneConfigSelector.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            validateState();
        }
    });

    statusLabel = new Label(composite, SWT.CENTER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    statusLabel.setLayoutData(gd);
    statusLabel.setFont(composite.getFont());
    statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));

    return composite;
}

From source file:org.eclipse.cdt.ui.newui.RenameConfigurationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create a group for the name & description

    final Group group1 = new Group(composite, SWT.NONE);
    group1.setFont(composite.getFont());
    GridLayout layout1 = new GridLayout(3, false);
    group1.setLayout(layout1);//from   w w  w.  j a  va  2s .c  o  m
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group1.setLayoutData(gd);

    // bug 187634: Add a label to warn user that configuration name will be used directly
    // as a directory name in the filesystem.
    Label warningLabel = new Label(group1, SWT.BEGINNING | SWT.WRAP);
    warningLabel.setFont(parent.getFont());
    warningLabel.setText(Messages.RenameConfiguration_label_warning);
    gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1);
    gd.widthHint = 300;
    warningLabel.setLayoutData(gd);

    // Add a label and a text widget for Configuration's name
    final Label nameLabel = new Label(group1, SWT.LEFT);
    nameLabel.setFont(parent.getFont());
    nameLabel.setText(Messages.RenameConfiguration_label_name);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);

    configName = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configName.setFont(group1.getFont());
    configName.setText(getNewName());
    configName.setFocus();
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configName.setLayoutData(gd);
    configName.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateState();
        }
    });

    //       Add a label and a text widget for Configuration's description
    final Label descriptionLabel = new Label(group1, SWT.LEFT);
    descriptionLabel.setFont(parent.getFont());
    descriptionLabel.setText(Messages.RenameConfiguration_label_description);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    descriptionLabel.setLayoutData(gd);
    configDescription = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configDescription.setFont(group1.getFont());
    configDescription.setText(getNewDescription());
    configDescription.setFocus();

    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configDescription.setLayoutData(gd);

    statusLabel = new Label(parent, SWT.CENTER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    statusLabel.setLayoutData(gd);
    statusLabel.setFont(composite.getFont());
    statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
    return composite;
}

From source file:org.eclipse.compare.codereview.compareEditor.RefacTextMergeViewer.java

License:Open Source License

/**
 * Creates a text merge viewer under the given parent control.
 *
 * @param parent the parent control/*from w  w w.j  a  v  a 2s.c  o  m*/
 * @param style SWT style bits for top level composite of this viewer
 * @param configuration the configuration object
 */
public RefacTextMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
    super(style, ResourceBundle.getBundle(BUNDLE_NAME), configuration);

    operationHistoryListener = new IOperationHistoryListener() {
        public void historyNotification(OperationHistoryEvent event) {
            RefacTextMergeViewer.this.historyNotification(event);
        }
    };
    OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(operationHistoryListener);

    fMerger = new DocumentMerger(new IDocumentMergerInput() {
        public ITokenComparator createTokenComparator(String line) {
            return RefacTextMergeViewer.this.createTokenComparator(line);
        }

        public CompareConfiguration getCompareConfiguration() {
            return RefacTextMergeViewer.this.getCompareConfiguration();
        }

        public IDocument getDocument(char contributor) {
            switch (contributor) {
            case LEFT_CONTRIBUTOR:
                return fLeft.getSourceViewer().getDocument();
            case RIGHT_CONTRIBUTOR:
                return fRight.getSourceViewer().getDocument();
            case ANCESTOR_CONTRIBUTOR:
                return fAncestor.getSourceViewer().getDocument();
            }
            return null;
        }

        public int getHunkStart() {
            return RefacTextMergeViewer.this.getHunkStart();
        }

        public Position getRegion(char contributor) {
            switch (contributor) {
            case LEFT_CONTRIBUTOR:
                return fLeft.getRegion();
            case RIGHT_CONTRIBUTOR:
                return fRight.getRegion();
            case ANCESTOR_CONTRIBUTOR:
                return fAncestor.getRegion();
            }
            return null;
        }

        public boolean isHunkOnLeft() {
            ITypedElement left = ((ICompareInput) getInput()).getRight();
            return left != null && Utilities.getAdapter(left, IHunk.class) != null;
        }

        public boolean isIgnoreAncestor() {
            return RefacTextMergeViewer.this.isIgnoreAncestor();
        }

        public boolean isPatchHunk() {
            return RefacTextMergeViewer.this.isPatchHunk();
        }

        public boolean isShowPseudoConflicts() {
            return fShowPseudoConflicts;
        }

        public boolean isThreeWay() {
            return RefacTextMergeViewer.this.isThreeWay();
        }

        public boolean isPatchHunkOk() {
            return RefacTextMergeViewer.this.isPatchHunkOk();
        }

    });

    int inheritedStyle = parent.getStyle();
    if ((inheritedStyle & SWT.LEFT_TO_RIGHT) != 0)
        fInheritedDirection = SWT.LEFT_TO_RIGHT;
    else if ((inheritedStyle & SWT.RIGHT_TO_LEFT) != 0)
        fInheritedDirection = SWT.RIGHT_TO_LEFT;
    else
        fInheritedDirection = SWT.NONE;

    if ((style & SWT.LEFT_TO_RIGHT) != 0)
        fTextDirection = SWT.LEFT_TO_RIGHT;
    else if ((style & SWT.RIGHT_TO_LEFT) != 0)
        fTextDirection = SWT.RIGHT_TO_LEFT;
    else
        fTextDirection = SWT.NONE;

    fSymbolicFontName = getSymbolicFontName();

    fIsMotif = Util.isMotif();
    fIsCarbon = Util.isCarbon();
    fIsMac = Util.isMac();

    if (fIsMotif)
        fMarginWidth = 0;

    fPreferenceChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            RefacTextMergeViewer.this.handlePropertyChangeEvent(event);
        }
    };

    fPreferenceStore = createChainedPreferenceStore();
    if (fPreferenceStore != null) {
        fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);

        fLeftIsLocal = Utilities.getBoolean(getCompareConfiguration(), "LEFT_IS_LOCAL", false); //$NON-NLS-1$
        fSynchronizedScrolling = fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
        fShowPseudoConflicts = fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
        //fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
        fUseSingleLine = fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
        fHighlightTokenChanges = fPreferenceStore.getBoolean(ComparePreferencePage.HIGHLIGHT_TOKEN_CHANGES);
        //fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
    }

    buildControl(parent);

    setColors();

    INavigatable nav = new INavigatable() {
        public boolean selectChange(int flag) {
            if (flag == INavigatable.FIRST_CHANGE || flag == INavigatable.LAST_CHANGE) {
                selectFirstDiff(flag == INavigatable.FIRST_CHANGE);
                return false;
            }
            return navigate(flag == INavigatable.NEXT_CHANGE, false, false);
        }

        public Object getInput() {
            return RefacTextMergeViewer.this.getInput();
        }

        public boolean openSelectedChange() {
            return false;
        }

        public boolean hasChange(int flag) {
            return getNextVisibleDiff(flag == INavigatable.NEXT_CHANGE, false) != null;
        }
    };
    fComposite.setData(INavigatable.NAVIGATOR_PROPERTY, nav);

    fBirdsEyeCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);

    JFaceResources.getFontRegistry().addListener(fPreferenceChangeListener);
    JFaceResources.getColorRegistry().addListener(fPreferenceChangeListener);
    updateFont();
}

From source file:org.eclipse.compare.codereview.compareEditor.RefacTextMergeViewer.java

License:Open Source License

private void updateColors(Display display) {

    if (display == null)
        display = fComposite.getDisplay();

    Color bgColor = null;//ww w .  j  a  v  a  2  s.  c o m
    if (fBackground != null)
        bgColor = getColor(display, fBackground);

    if (fAncestor != null)
        fAncestor.setBackgroundColor(bgColor);
    if (fLeft != null)
        fLeft.setBackgroundColor(bgColor);
    if (fRight != null)
        fRight.setBackgroundColor(bgColor);

    Color fgColor = null;
    if (fForeground != null)
        fgColor = getColor(display, fForeground);

    if (fAncestor != null)
        fAncestor.setForegroundColor(fgColor);
    if (fLeft != null)
        fLeft.setForegroundColor(fgColor);
    if (fRight != null)
        fRight.setForegroundColor(fgColor);

    ColorRegistry registry = JFaceResources.getColorRegistry();

    RGB bg = getBackground(display);
    SELECTED_INCOMING = registry.getRGB(INCOMING_COLOR);
    if (SELECTED_INCOMING == null)
        SELECTED_INCOMING = new RGB(0, 0, 255); // BLUE
    INCOMING = interpolate(SELECTED_INCOMING, bg, 0.6);
    INCOMING_FILL = interpolate(SELECTED_INCOMING, bg, 0.97);
    INCOMING_TEXT_FILL = interpolate(SELECTED_INCOMING, bg, 0.85);

    SELECTED_OUTGOING = registry.getRGB(OUTGOING_COLOR);
    if (SELECTED_OUTGOING == null)
        SELECTED_OUTGOING = new RGB(0, 0, 0); // BLACK
    OUTGOING = interpolate(SELECTED_OUTGOING, bg, 0.6);
    OUTGOING_FILL = interpolate(SELECTED_OUTGOING, bg, 0.97);
    OUTGOING_TEXT_FILL = interpolate(SELECTED_OUTGOING, bg, 0.85);

    SELECTED_CONFLICT = registry.getRGB(CONFLICTING_COLOR);
    if (SELECTED_CONFLICT == null)
        SELECTED_CONFLICT = new RGB(255, 0, 0); // RED
    CONFLICT = interpolate(SELECTED_CONFLICT, bg, 0.6);
    CONFLICT_FILL = interpolate(SELECTED_CONFLICT, bg, 0.97);
    CONFLICT_TEXT_FILL = interpolate(SELECTED_CONFLICT, bg, 0.85);

    RESOLVED = registry.getRGB(RESOLVED_COLOR);
    if (RESOLVED == null)
        RESOLVED = new RGB(0, 255, 0); // GREEN

    updatePresentation();
}

From source file:org.eclipse.compare.codereview.compareEditor.RefacTextMergeViewer.java

License:Open Source License

/**
 * Called on the viewer disposal./*  w w  w  .  ja  va  2 s. c  o  m*/
 * Unregisters from the compare configuration.
 * Clients may extend if they have to do additional cleanup.
 * @param event
 */
protected void handleDispose(DisposeEvent event) {
    OperationHistoryFactory.getOperationHistory().removeOperationHistoryListener(operationHistoryListener);

    if (fHandlerService != null)
        fHandlerService.dispose();

    Object input = getInput();
    removeFromDocumentManager(ANCESTOR_CONTRIBUTOR, input);
    removeFromDocumentManager(LEFT_CONTRIBUTOR, input);
    removeFromDocumentManager(RIGHT_CONTRIBUTOR, input);

    if (DEBUG)
        DocumentManager.dump();

    if (fPreferenceChangeListener != null) {
        JFaceResources.getFontRegistry().removeListener(fPreferenceChangeListener);
        JFaceResources.getColorRegistry().removeListener(fPreferenceChangeListener);
        if (fPreferenceStore != null)
            fPreferenceStore.removePropertyChangeListener(fPreferenceChangeListener);
        fPreferenceChangeListener = null;
    }

    fLeftCanvas = null;
    fRightCanvas = null;
    fVScrollBar = null;
    fBirdsEyeCanvas = null;
    fSummaryHeader = null;

    fAncestorContributor.unsetDocument(fAncestor);
    fLeftContributor.unsetDocument(fLeft);
    fRightContributor.unsetDocument(fRight);

    disconnect(fLeftContributor);
    disconnect(fRightContributor);
    disconnect(fAncestorContributor);

    if (fBirdsEyeCursor != null) {
        fBirdsEyeCursor.dispose();
        fBirdsEyeCursor = null;
    }

    if (showWhitespaceAction != null)
        showWhitespaceAction.dispose();

    if (toggleLineNumbersAction != null)
        toggleLineNumbersAction.dispose();

    if (fIgnoreWhitespace != null)
        fIgnoreWhitespace.dispose();

    getCompareConfiguration().setProperty(ChangeCompareFilterPropertyAction.COMPARE_FILTERS_INITIALIZING,
            Boolean.TRUE);
    disposeCompareFilterActions(false);

    if (fSourceViewerDecorationSupport != null) {
        for (Iterator iterator = fSourceViewerDecorationSupport.iterator(); iterator.hasNext();) {
            ((SourceViewerDecorationSupport) iterator.next()).dispose();
        }
        fSourceViewerDecorationSupport = null;
    }

    if (fAncestor != null)
        fAncestor.dispose();
    fAncestor = null;
    if (fLeft != null)
        fLeft.dispose();
    fLeft = null;
    if (fRight != null)
        fRight.dispose();
    fRight = null;

    if (fColors != null) {
        Iterator i = fColors.values().iterator();
        while (i.hasNext()) {
            Color color = (Color) i.next();
            if (!color.isDisposed())
                color.dispose();
        }
        fColors = null;
    }
    // don't add anything here, disposing colors should be done last      
    super.handleDispose(event);
}

From source file:org.eclipse.compare.contentmergeviewer.TextMergeViewer.java

License:Open Source License

/**
 * Creates a text merge viewer under the given parent control.
 *
 * @param parent the parent control/*  w ww. j av  a2  s .  co m*/
 * @param style SWT style bits for top level composite of this viewer
 * @param configuration the configuration object
 */
public TextMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
    super(style, ResourceBundle.getBundle(BUNDLE_NAME), configuration);

    operationHistoryListener = new IOperationHistoryListener() {
        public void historyNotification(OperationHistoryEvent event) {
            TextMergeViewer.this.historyNotification(event);
        }
    };
    OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(operationHistoryListener);

    fMerger = new DocumentMerger(new IDocumentMergerInput() {
        public ITokenComparator createTokenComparator(String line) {
            return TextMergeViewer.this.createTokenComparator(line);
        }

        public CompareConfiguration getCompareConfiguration() {
            return TextMergeViewer.this.getCompareConfiguration();
        }

        public IDocument getDocument(char contributor) {
            switch (contributor) {
            case LEFT_CONTRIBUTOR:
                return fLeft.getSourceViewer().getDocument();
            case RIGHT_CONTRIBUTOR:
                return fRight.getSourceViewer().getDocument();
            case ANCESTOR_CONTRIBUTOR:
                return fAncestor.getSourceViewer().getDocument();
            }
            return null;
        }

        public int getHunkStart() {
            return TextMergeViewer.this.getHunkStart();
        }

        public Position getRegion(char contributor) {
            switch (contributor) {
            case LEFT_CONTRIBUTOR:
                return fLeft.getRegion();
            case RIGHT_CONTRIBUTOR:
                return fRight.getRegion();
            case ANCESTOR_CONTRIBUTOR:
                return fAncestor.getRegion();
            }
            return null;
        }

        public boolean isHunkOnLeft() {
            ITypedElement left = ((ICompareInput) getInput()).getRight();
            return left != null && Utilities.getAdapter(left, IHunk.class) != null;
        }

        public boolean isIgnoreAncestor() {
            return TextMergeViewer.this.isIgnoreAncestor();
        }

        public boolean isPatchHunk() {
            return TextMergeViewer.this.isPatchHunk();
        }

        public boolean isShowPseudoConflicts() {
            return fShowPseudoConflicts;
        }

        public boolean isThreeWay() {
            return TextMergeViewer.this.isThreeWay();
        }

        public boolean isPatchHunkOk() {
            return TextMergeViewer.this.isPatchHunkOk();
        }

    });

    int inheritedStyle = parent.getStyle();
    if ((inheritedStyle & SWT.LEFT_TO_RIGHT) != 0)
        fInheritedDirection = SWT.LEFT_TO_RIGHT;
    else if ((inheritedStyle & SWT.RIGHT_TO_LEFT) != 0)
        fInheritedDirection = SWT.RIGHT_TO_LEFT;
    else
        fInheritedDirection = SWT.NONE;

    if ((style & SWT.LEFT_TO_RIGHT) != 0)
        fTextDirection = SWT.LEFT_TO_RIGHT;
    else if ((style & SWT.RIGHT_TO_LEFT) != 0)
        fTextDirection = SWT.RIGHT_TO_LEFT;
    else
        fTextDirection = SWT.NONE;

    fSymbolicFontName = getSymbolicFontName();

    fIsMotif = Util.isMotif();
    fIsCarbon = Util.isCarbon();
    fIsMac = Util.isMac();

    if (fIsMotif)
        fMarginWidth = 0;

    fPreferenceChangeListener = new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            TextMergeViewer.this.handlePropertyChangeEvent(event);
        }
    };

    fPreferenceStore = createChainedPreferenceStore();
    if (fPreferenceStore != null) {
        fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);

        fLeftIsLocal = Utilities.getBoolean(getCompareConfiguration(), "LEFT_IS_LOCAL", false); //$NON-NLS-1$
        fSynchronizedScrolling = fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
        fShowPseudoConflicts = fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
        //fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
        fUseSingleLine = fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
        fHighlightTokenChanges = fPreferenceStore.getBoolean(ComparePreferencePage.HIGHLIGHT_TOKEN_CHANGES);
        //fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
    }

    buildControl(parent);

    setColors();

    INavigatable nav = new INavigatable() {
        public boolean selectChange(int flag) {
            if (flag == INavigatable.FIRST_CHANGE || flag == INavigatable.LAST_CHANGE) {
                selectFirstDiff(flag == INavigatable.FIRST_CHANGE);
                return false;
            }
            return navigate(flag == INavigatable.NEXT_CHANGE, false, false);
        }

        public Object getInput() {
            return TextMergeViewer.this.getInput();
        }

        public boolean openSelectedChange() {
            return false;
        }

        public boolean hasChange(int flag) {
            return getNextVisibleDiff(flag == INavigatable.NEXT_CHANGE, false) != null;
        }
    };
    fComposite.setData(INavigatable.NAVIGATOR_PROPERTY, nav);

    fBirdsEyeCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);

    JFaceResources.getFontRegistry().addListener(fPreferenceChangeListener);
    JFaceResources.getColorRegistry().addListener(fPreferenceChangeListener);
    updateFont();
}

From source file:org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.java

License:Open Source License

/**
 * Creates the tab folder for displaying config instances
 * @param parent/*from  w w w  . j a v  a  2 s.co m*/
 */
private void createTabFolder(Composite parent) {
    if (fTabFolder == null) {
        ColorRegistry reg = JFaceResources.getColorRegistry();
        Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), //$NON-NLS-1$
                c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); //$NON-NLS-1$
        fTabFolder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.FLAT);
        fTabFolder.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true);
        fTabFolder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$
        fTabFolder.setSimple(PlatformUI.getPreferenceStore()
                .getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
        fTabFolder.setBorderVisible(true);
        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.horizontalSpan = 2;
        fTabFolder.setLayoutData(gd);
        fTabFolder.setFont(parent.getFont());
        fTabFolder.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                if (!fInitializingTabs) {
                    handleTabSelected();
                    refresh();
                }
            }
        });
    }
}

From source file:org.eclipse.debug.internal.ui.views.memory.RenderingViewPane.java

License:Open Source License

private CTabFolder createTabFolder(Composite parent) {
    CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT);

    ColorRegistry reg = JFaceResources.getColorRegistry();
    Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), //$NON-NLS-1$
            c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); //$NON-NLS-1$
    folder.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true);
    folder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$
    folder.setSimple(PlatformUI.getPreferenceStore()
            .getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
    folder.setBorderVisible(true);//from  ww w .  j  a v  a2  s.c  o m
    folder.setFont(fViewPaneCanvas.getFont());

    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        public void close(CTabFolderEvent event) {
            if (event.item.getData() instanceof MemoryViewTab)
                RenderingViewPane.this
                        .removeMemoryRendering(((MemoryViewTab) event.item.getData()).getRendering());
            event.doit = false;
        }
    });
    return folder;
}

From source file:org.eclipse.dltk.mod.ui.browsing.ColoredViewersManager.java

License:Open Source License

public ColoredViewersManager() {
    fManagedViewers = new HashMap();
    fColorRegisty = JFaceResources.getColorRegistry();
}

From source file:org.eclipse.dltk.mod.ui.infoviews.AbstractInfoView.java

License:Open Source License

private void inititalizeColors() {
    if (getSite().getShell().isDisposed())
        return;/*w  w  w .  ja  v a  2 s  . co m*/
    Display display = getSite().getShell().getDisplay();
    if (display == null || display.isDisposed())
        return;
    setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    ColorRegistry registry = JFaceResources.getColorRegistry();
    registry.addListener(this);
    fBackgroundColorRGB = registry.getRGB(getBackgroundColorKey());
    Color bgColor;
    if (fBackgroundColorRGB == null) {
        bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
        fBackgroundColorRGB = bgColor.getRGB();
    } else {
        bgColor = new Color(display, fBackgroundColorRGB);
        fBackgroundColor = bgColor;
    }
    setBackground(bgColor);
}