List of usage examples for org.eclipse.jface.resource JFaceResources getColorRegistry
public static ColorRegistry getColorRegistry()
From source file:org.dawnsci.plotting.tools.region.RegionEditorTool.java
License:Open Source License
@Override public void createControl(Composite parent) { this.control = new Composite(parent, SWT.NONE); control.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); control.setLayout(new GridLayout(1, false)); GridUtils.removeMargins(control);/*from w w w . j av a2 s. com*/ this.filteredTree = new ClearableFilteredTree(control, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, new NodeFilter(this), true, "Enter search string to filter the tree.\nThis will match on name, value or units"); viewer = filteredTree.getViewer(); viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createColumns(viewer); viewer.setContentProvider(new TreeNodeContentProvider()); // Swing tree nodes viewer.getTree().setLinesVisible(true); viewer.getTree().setHeaderVisible(true); viewer.getControl().addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { if (e.keyCode == SWT.DEL) { ITreeSelection selection = (ITreeSelection) viewer.getSelection(); Iterator<?> it = selection.iterator(); while (it.hasNext()) { Object object = (Object) it.next(); if (object instanceof RegionEditorNode) { RegionEditorNode regionNode = (RegionEditorNode) object; IRegion region = getPlottingSystem().getRegion(regionNode.getRegion().getName()); model.removeRegion(regionNode); region.removeROIListener(RegionEditorTool.this); getPlottingSystem().removeRegion(region); } } } } }); Composite status = new Composite(control, SWT.NONE); status.setLayoutData(new GridData(SWT.FILL, GridData.FILL, true, false)); status.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); status.setLayout(new GridLayout(1, true)); GridUtils.removeMargins(status); ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); final Label label = new Label(status, SWT.RIGHT); label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); label.setForeground(new Color(label.getDisplay(), colorRegistry.getRGB(JFacePreferences.QUALIFIER_COLOR))); label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); label.setText("* Click to change value "); createRegionEditorModel(true); createActions(); getSite().setSelectionProvider(viewer); this.viewUpdateListener = new RegionEditorColorListener(); activate(); }
From source file:org.deved.antlride.internal.ui.views.interpreter.AntlrFigure.java
License:Open Source License
public AntlrFigure(IEvalElement evalElement, int x, int y) { //setStyle(Clickable.STYLE_BUTTON); setCursor(Cursors.HAND);// w w w. j a v a2 s. c o m this.element = evalElement; setLayoutManager(new BorderLayout()); Font font = JFaceResources.getFont("Monospaced"); Label label = new Label(); Label tooltip = new Label(); EvalElementKind kind = evalElement.getElementKind(); String labelText = null; String labelToolTipText = null; Color foregroundColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); switch (kind) { case RULE: { labelText = evalElement.getElementName(); labelToolTipText = String.format(RULE_TOOL_TIP_PATTERN, labelText); if (!((IRuleEvalElement) evalElement).isLexerRule()) { foregroundColor = JFaceResources.getColorRegistry().get(AntlrPreferenceConstants.EDITOR_RULE_COLOR); } } break; case TOKEN: { ITokenEvalElement token = (ITokenEvalElement) evalElement; labelText = "'" + evalElement.getElementName() + "'"; labelToolTipText = String.format(LOCATION_TOOL_TIP_PATTERN, evalElement.getElementName(), token.getLine(), token.getColumn() + 1); foregroundColor = JFaceResources.getColorRegistry().get(AntlrPreferenceConstants.EDITOR_STRING_COLOR); } break; case EXCEPTION: { IExceptionEvalElement exception = (IExceptionEvalElement) evalElement; labelText = evalElement.getElementName(); // labelToolTipText = String.format(LOCATION_TOOL_TIP_PATTERN, // labelText, exception.getLine(), exception.getColumn() + 1); labelToolTipText = exception.getMessage(); foregroundColor = Display.getCurrent().getSystemColor(SWT.COLOR_RED); } break; } // text label.setFont(font); label.setText(labelText); label.setForegroundColor(foregroundColor); // tooltip tooltip.setText(labelToolTipText); setToolTip(tooltip); // add text label add(label, BorderLayout.CENTER); //setBorder(new SimpleRaisedBorder()); setBorder(new LineBorder(ColorConstants.black, 1)); Dimension size = FigureUtilities.getTextExtents(labelText + " ", font); this.x = x; this.y = y; this.width = size.width + (size.width * 2 / 10); this.height = size.height + (size.height * 2 / 5); }
From source file:org.deved.antlride.internal.viz.RuleBasedGraphViewer.java
License:Open Source License
protected void createControl(Composite composite) { GridData gd;/*w w w. j ava2 s. c om*/ SashForm sashForm = new SashForm(composite, SWT.HORIZONTAL); Composite leftPane = new Composite(sashForm, SWT.NONE); leftPane.setLayout(new GridLayout(3, false)); Label label = new Label(leftPane, SWT.NONE); label.setText("Rule:"); label.setToolTipText("Search Rule"); final Text ruleText = new Text(leftPane, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); ruleText.setLayoutData(gd); ruleText.setToolTipText("Search Rule"); ruleText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { ruleViewer.refresh(); } }); ToolBar bar = new ToolBar(leftPane, SWT.HORIZONTAL); ToolItem clearFilter = new ToolItem(bar, SWT.PUSH); clearFilter.setToolTipText("Clear"); clearFilter.setImage(AntlrImages.getImage(AntlrImages.CLEAR)); clearFilter.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { ruleText.setText(""); ruleViewer.refresh(); } public void widgetDefaultSelected(SelectionEvent e) { } }); ruleViewer = new TreeViewer(leftPane); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 3; ruleViewer.getTree().setLayoutData(gd); ruleViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { String ruleName = ruleText.getText().toLowerCase(); if (ruleName.length() > 0) { boolean select = false; if (element instanceof IRule) { IRule rule = (IRule) element; select = rule.getElementName().toLowerCase().startsWith(ruleName); } if (select) { ruleViewer.setSelection(new StructuredSelection(element)); } return select; } return true; } }); ruleViewer.setLabelProvider(new RuleLabelProvider()); ruleViewer.setContentProvider(new RuleContentProvider()); ruleViewer.addSelectionChangedListener(new GraphSelectionListener()); Composite rightPane = new Composite(sashForm, SWT.NONE); rightPane.setLayout(new GridLayout(2, false)); bar = new ToolBar(rightPane, SWT.FLAT | SWT.RIGHT | SWT.HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment = SWT.END; gd.horizontalSpan = 2; bar.setLayoutData(gd); // add actions IToolBarManager barManager = new ToolBarManager(bar); barManager.add(new ZoomInAction()); barManager.add(new ZoomOutAction()); barManager.add(new ClearAction()); fillToolBar(barManager); barManager.update(true); canvas = new Canvas(rightPane, SWT.BORDER); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; canvas.setLayoutData(gd); Color color = JFaceResources.getColorRegistry().get(AntlrPreferenceConstants.EDITOR_BACKGROUND_COLOR); canvas.setBackground(color == null ? ColorConstants.white : color); lightweightSystem = new LightweightSystem(canvas); sashForm.setWeights(new int[] { 30, 70 }); control = sashForm; }
From source file:org.deved.antlride.ui.AntlrPreferenceConstants.java
License:Open Source License
public static void initializeDefaultValues(IPreferenceStore store) { PreferenceConstants.initializeDefaultValues(store); // Comment's// www.j av a2 s .com RGB commentRgb = new RGB(63, 127, 95); PreferenceConverter.setDefault(store, EDITOR_SINGLE_LINE_COMMENT_COLOR, commentRgb); store.setDefault(EDITOR_SINGLE_LINE_COMMENT_BOLD, false); store.setDefault(EDITOR_SINGLE_LINE_COMMENT_ITALIC, false); store.setDefault(EDITOR_COMMENTS_FOLDING_ENABLED, true); store.setDefault(PreferenceConstants.EDITOR_FOLDING_INIT_COMMENTS, true); store.setDefault(PreferenceConstants.EDITOR_FOLDING_INIT_HEADER_COMMENTS, true); PreferenceConverter.setDefault(store, EDITOR_MULTI_LINE_COMMENT_COLOR, commentRgb); store.setDefault(EDITOR_MULTI_LINE_COMMENT_BOLD, false); store.setDefault(EDITOR_MULTI_LINE_COMMENT_ITALIC, false); PreferenceConverter.setDefault(store, EDITOR_DOC_COMMENT_COLOR, new RGB(63, 95, 191)); store.setDefault(EDITOR_DOC_COMMENT_BOLD, false); store.setDefault(EDITOR_DOC_COMMENT_ITALIC, false); PreferenceConverter.setDefault(store, EDITOR_TARGET_LANGUAGE_COMMENT_COLOR, new RGB(128, 128, 128)); store.setDefault(EDITOR_TARGET_LANGUAGE_COMMENT_BOLD, false); store.setDefault(EDITOR_TARGET_LANGUAGE_COMMENT_ITALIC, false); // keyword's RGB keywordRgb = new RGB(127, 0, 85); PreferenceConverter.setDefault(store, EDITOR_KEYWORD_COLOR, keywordRgb); store.setDefault(EDITOR_KEYWORD_BOLD, true); store.setDefault(EDITOR_KEYWORD_ITALIC, false); PreferenceConverter.setDefault(store, EDITOR_KEYWORD_RETURNS_COLOR, keywordRgb); store.setDefault(EDITOR_KEYWORD_RETURNS_BOLD, true); store.setDefault(EDITOR_KEYWORD_RETURNS_ITALIC, false); PreferenceConverter.setDefault(store, EDITOR_TARGET_LANGUAGE_KEYWORD_COLOR, new RGB(0, 0, 128)); store.setDefault(EDITOR_TARGET_LANGUAGE_KEYWORD_BOLD, true); store.setDefault(EDITOR_TARGET_LANGUAGE_KEYWORD_ITALIC, false); // Literal's RGB literalRgb = new RGB(42, 0, 255); PreferenceConverter.setDefault(store, EDITOR_STRING_COLOR, literalRgb); PreferenceConverter.setDefault(store, EDITOR_TARGET_LANGUAGE_LITERAL_COLOR, new RGB(0, 128, 0)); store.setDefault(EDITOR_TARGET_LANGUAGE_LITERAL_BOLD, true); // Rule's RGB ruleRgb = new RGB(0, 64, 128); PreferenceConverter.setDefault(store, EDITOR_RULE_COLOR, ruleRgb); store.setDefault(EDITOR_RULE_BOLD, false); PreferenceConverter.setDefault(store, EDITOR_LOCAL_VAR_REFERENCE_COLOR, new RGB(0, 0, 192)); store.setDefault(EDITOR_LOCAL_VAR_REFERENCE_BOLD, false); RGB blackRgb = new RGB(0, 0, 0); PreferenceConverter.setDefault(store, EDITOR_LOCAL_VAR_DECLARATION_COLOR, blackRgb); store.setDefault(EDITOR_LOCAL_VAR_DECLARATION_BOLD, false); PreferenceConverter.setDefault(store, EDITOR_OTHERS_COLOR, blackRgb); PreferenceConverter.setDefault(store, EDITOR_LEXER_RULE_COLOR, blackRgb); store.setDefault(EDITOR_LEXER_RULE_ITALIC, true); // @ grammar actions PreferenceConverter.setDefault(store, EDITOR_GRAMMAR_ACTION_COLOR, keywordRgb); store.setDefault(EDITOR_GRAMMAR_ACTION_BOLD, false); PreferenceConverter.setDefault(store, EDITOR_UNKNOW_GRAMMAR_ACTION_COLOR, keywordRgb); store.setDefault(EDITOR_UNKNOW_GRAMMAR_ACTION_BOLD, false); store.setDefault(EDITOR_UNKNOW_GRAMMAR_ACTION_UNDERLINE, false); RGB red = new RGB(255, 0, 0); PreferenceConverter.setDefault(store, EDITOR_REWRITE_OPERATOR_COLOR, red); store.setDefault(EDITOR_REWRITE_OPERATOR_BOLD, false); store.setDefault(EDITOR_REWRITE_OPERATOR_UNDERLINE, false); // editor store.setDefault(EDITOR_SMART_INDENT, true); store.setDefault(EDITOR_CLOSE_STRINGS, true); store.setDefault(EDITOR_CLOSE_BRACKETS, true); store.setDefault(EDITOR_CLOSE_BRACES, true); store.setDefault(EDITOR_SMART_TAB, true); store.setDefault(EDITOR_SMART_PASTE, true); store.setDefault(EDITOR_SMART_HOME_END, true); store.setDefault(EDITOR_SUB_WORD_NAVIGATION, true); store.setDefault(EDITOR_TAB_WIDTH, 2); store.setDefault(EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true); // folding store.setDefault(PreferenceConstants.EDITOR_FOLDING_ENABLED, true); store.setDefault(EDITOR_OPTIONS_FOLDING_ENABLED, true); store.setDefault(EDITOR_TOKENS_SPECIFICATION_FOLDING_ENABLED, true); store.setDefault(EDITOR_SCOPES_FOLDING_ENABLED, true); store.setDefault(EDITOR_GRAMMAR_ACTION_FOLDING_ENABLED, true); store.setDefault(EDITOR_RULE_FOLDING_ENABLED, false); store.setDefault(AntlrPreferenceConstants.EDITOR_FOLDING_LINES_LIMIT, 2); store.setDefault(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.SPACE); store.setDefault(CodeFormatterConstants.FORMATTER_TAB_SIZE, "2");//$NON-NLS-1$ store.setDefault(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "2");//$NON-NLS-1$ // NewScriptProjectPreferencePage.initDefaults(store); store.setDefault(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES, false); store.setDefault(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE, false); store.setDefault(PreferenceConstants.APPEARANCE_METHOD_TYPEPARAMETERS, true); store.setDefault(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW, ""); //$NON-NLS-1$ store.setDefault(PreferenceConstants.SHOW_SOURCE_MODULE_CHILDREN, true); // code assist store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION, true); store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS, ".$:");//$NON-NLS-1$ store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY, 300); store.setDefault(PreferenceConstants.CODEASSIST_INSERT_COMPLETION, false); // ###################################################################### // ################ // core options // ###################################################################### // ################ // code generator store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_PROFILE, false); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_TRACE, false); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_X_DBG_ST, false); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_MAX_MEMORY, 0); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_X_MAX_SWITCH_CASE_LABELS, 300); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_X_MIN_SWITCH_ALTS, 3); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_OUTPUT_FOLDER, ""); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_OUTPUT_OPTION, AntlrConstants.ANTLR_CODE_GENERATOR_OUTPUT_OPTION_SAME_AS_GRAMMAR); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_DEBUG, false); store.setDefault(AntlrConstants.ANTLR_CODE_GENERATOR_APPEND_JAVA_PACKAGE_TO_OUTPUT_FOLDER, false); // save actions store.setDefault(AntlrConstants.ANTLR_SAVE_ACTIONS_ENABLED, true); store.setDefault(AntlrConstants.ANTLR_SAVE_ACTIONS_GENERATE_RESOURCES_ENABLED, true); store.setDefault(AntlrConstants.ANTLR_SAVE_ACTIONS_FORMAT_CODE_ENABLED, false); // builder store.setDefault(AntlrConstants.ANTLR_BUILDER_MAX_NUMBER_OF_PROBLEMS_REPORTED_PER_GRAMMAR, 25); store.setDefault(AntlrConstants.ANTLR_BUILDER_INCLUDE_STACK_TRACE_ON_INTERNAL_ERRORS, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_REPORT, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_NFA, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_DFA, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_DFA, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_NO_PRUNE, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_NO_COLLAPSE, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_DBG_CONVERSION, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_NO_MERGE_STOP_STATES, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_DFA_VERBOSE, false); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_M, 4); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_MAX_DFA_EDGES, 65534); store.setDefault(AntlrConstants.ANTLR_BUILDER_X_CONVERSION_TIME_OUT, 1000); // general store.setDefault(AntlrConstants.ANTLR_GENERAL_MARK_GENERATED_RESOURCES_AS_DERIVED, true); //views store.setDefault(DFA_VIEW, false); store.setDefault(RAILROAD_VIEW, true); //color sync Collection<String> colorKeys = getColorKeys(); for (String colorKey : colorKeys) { JFaceResources.getColorRegistry().put(colorKey, PreferenceConverter.getColor(store, colorKey)); } }
From source file:org.deved.antlride.ui.AntlrUI.java
License:Open Source License
@Override public IPreferenceStore getPreferenceStore() { final IPreferenceStore preferenceStore = super.getPreferenceStore(); if (fPropertyChangeListener == null) { fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { Preferences preferences = AntlrCore.getDefault().getPluginPreferences(); String property = event.getProperty(); if (property.startsWith("antlr_core")) { preferences.setValue(property, String.valueOf(event.getNewValue())); } else if (AntlrPreferenceConstants.getColorKeys().contains(property)) { Object value = event.getNewValue(); try { RGB color = value instanceof RGB ? (RGB) value : StringConverter.asRGB(value.toString()); JFaceResources.getColorRegistry().put(property, color); } catch (DataFormatException ex) { //Some values are not colors //ignore the exception }/*from w w w. j a v a 2 s . co m*/ } } }; preferenceStore.addPropertyChangeListener(fPropertyChangeListener); } return preferenceStore; }
From source file:org.deved.antlride.ui.text.AntlrInputSourceViewer.java
License:Open Source License
private StyleRange createStyleRange(int start, int length) { StyleRange styleRange = new StyleRange(); styleRange.start = start;/*from w ww. ja v a 2s. c om*/ styleRange.length = length; styleRange.fontStyle = SWT.BOLD; styleRange.foreground = JFaceResources.getColorRegistry() .get(AntlrPreferenceConstants.EDITOR_KEYWORD_COLOR); return styleRange; }
From source file:org.eclipse.ant.internal.ui.editor.AntEditorSourceViewerConfiguration.java
License:Open Source License
@Override public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { fContentAssistant = new ContentAssistant(); AntEditorCompletionProcessor processor = new AntEditorCompletionProcessor(fEditor.getAntModel()); fContentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); fContentAssistant.setContentAssistProcessor(processor, AntEditorPartitionScanner.XML_TAG); fContentAssistant.setDocumentPartitioning(AntDocumentSetupParticipant.ANT_PARTITIONING); String triggers = fPreferenceStore .getString(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS); if (triggers != null) { processor.setCompletionProposalAutoActivationCharacters(triggers.toCharArray()); }/* ww w . j a va 2s .c om*/ fContentAssistant .enableAutoInsert(fPreferenceStore.getBoolean(AntEditorPreferenceConstants.CODEASSIST_AUTOINSERT)); fContentAssistant.enableAutoActivation( fPreferenceStore.getBoolean(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION)); fContentAssistant.setAutoActivationDelay( fPreferenceStore.getInt(AntEditorPreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY)); fContentAssistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY); fContentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE); fContentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); Color background = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR); fContentAssistant.setContextInformationPopupBackground(background); fContentAssistant.setContextSelectorBackground(background); Color foreground = JFaceResources.getColorRegistry().get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR); fContentAssistant.setContextInformationPopupForeground(foreground); fContentAssistant.setContextSelectorForeground(foreground); IInformationControlCreator creator = getInformationControlCreator(sourceViewer); fContentAssistant.setInformationControlCreator(creator); fContentAssistant.setRepeatedInvocationMode(true); fContentAssistant.setStatusLineVisible(true); fContentAssistant.setShowEmptyList(true); fContentAssistant.addCompletionListener(processor); return fContentAssistant; }
From source file:org.eclipse.birt.chart.ui.swt.ColorPalette.java
License:Open Source License
/** * This map stores color name - Color pairs, used to quickly lookup a Color * of a predefined color./*w w w .ja va 2 s. c o m*/ * * @param rgb * RGB value of color */ private Color getColor(RGB rgb) { if (rgb == null) { return null; } String key = rgb.toString(); Color color = JFaceResources.getColorRegistry().get(key); if (color == null) { JFaceResources.getColorRegistry().put(key, rgb); color = JFaceResources.getColorRegistry().get(key); } return color; }
From source file:org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane.java
License:Open Source License
public void dispose() { getEditorPreferenceStore().removePropertyChangeListener(this); JFaceResources.getFontRegistry().removeListener(this); JFaceResources.getColorRegistry().removeListener(this); if (fSourceViewerDecorationSupport != null) { fSourceViewerDecorationSupport.dispose(); fSourceViewerDecorationSupport = null; }//w w w.j ava2s .com if (fActions != null) { fActions.clear(); fActions = null; } }
From source file:org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane.java
License:Open Source License
protected VirtualSourceViewer createViewer(Composite parent, IVerticalRuler vertRuler, IOverviewRuler ovRuler) { int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; VirtualSourceViewer viewer = new VirtualSourceViewer(parent, fVerticalRuler, fOverviewRuler, true, styles); viewer.getControl().setLayoutData(parent.getLayoutData()); viewer.setEditable(false);/* w w w . j a v a 2 s . c o m*/ viewer.getTextWidget().setFont(JFaceResources.getFont(IInternalCDebugUIConstants.DISASSEMBLY_FONT)); viewer.setRangeIndicator(new DefaultRangeIndicator()); getSourceViewerDecorationSupport(viewer); viewer.configure(new SourceViewerConfiguration()); JFaceResources.getFontRegistry().addListener(this); JFaceResources.getColorRegistry().addListener(this); getEditorPreferenceStore().addPropertyChangeListener(this); return viewer; }