public RTCTypeToRTTypeWidget(Composite parent, int style) { super(parent, style); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); terminologic_level_color = themeManager .getTheme("org.dafoe.terminologiclevel.themeId") .getColorRegistry() .get("org.dafoe.application.backcolor"); // $NON-NLS-1$ //$NON-NLS-2$ terminoontologic_level_color = themeManager .getTheme("org.dafoe.terminoontologiclevel.themeId") .getColorRegistry() .get("org.dafoe.application.backcolor"); // $NON-NLS-1$ //$NON-NLS-2$ this.setLayout(new GridLayout()); GridData gd; gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); this.setLayoutData(gd); shell = this.getShell(); createContent(); }
public TerminologicalViewPart() { currentTerminoConcept = null; IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); terminologicColor = themeManager .getTheme("org.dafoe.terminologiclevel.themeId") .getColorRegistry() .get("org.dafoe.application.backcolor"); // $NON-NLS-1$ //$NON-NLS-2$ }
public void dispose() { IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); themeManager.removePropertyChangeListener(themeChangeListener); ITheme theme = themeManager.getCurrentTheme(); theme.removePropertyChangeListener(themeChangeListener); if (content != null) content.dispose(); up.dispose(); down.dispose(); equal.dispose(); }
@Override public void initialize(IWorkbenchConfigurer configurer) { // 윈도우 위치와 크기 저장 configurer.setSaveAndRestore(true); // 색상변경 IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); ITheme currentTheme = themeManager.getCurrentTheme(); ColorRegistry colorRegistry = currentTheme.getColorRegistry(); colorRegistry.put(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START, new RGB(16, 86, 100)); colorRegistry.put(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END, new RGB(219, 238, 241)); colorRegistry.put(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR, new RGB(0, 0, 255)); colorRegistry.put(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT, new RGB(255, 0, 0)); super.initialize(configurer); }
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(IThemeManager.CHANGE_CURRENT_THEME)) { ((ITheme) event.getOldValue()).removePropertyChangeListener(this); setTheme((ITheme) event.getNewValue()); } else { IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); ITheme theme = themeManager.getCurrentTheme(); if (event.getProperty().equals(BACKGROUND)) background = theme.getColorRegistry().get(event.getProperty()); else if (event.getProperty().equals(FOREGROUND)) foreground = theme.getColorRegistry().get(event.getProperty()); else if (event.getProperty().equals(POSITIVE_FOREGROUND)) positiveForeground = theme.getColorRegistry().get(event.getProperty()); else if (event.getProperty().equals(NEGATIVE_FOREGROUND)) negativeForeground = theme.getColorRegistry().get(event.getProperty()); } updateView(); }
/** * Initialize default fonts. Causes this to re-read font preferences from the preference store. * Calling this method should only be necessary if font preferences have changed, or if the font * preference keys have changed. * * @since 1.3 * @see #getFontPreference() * @see #getMonospaceFontPreference() */ public void initializeDefaultFonts() { Font defaultFont = null; Font defaultMonospaceFont = null; if (WikiTextUiPlugin.getDefault() != null) { IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); FontRegistry fontRegistry = themeManager.getCurrentTheme().getFontRegistry(); defaultFont = fontRegistry.get(fontPreference); defaultMonospaceFont = fontRegistry.get(monospaceFontPreference); } if (defaultFont == null) { // could be the case when running stand-alone defaultFont = JFaceResources.getDefaultFont(); } if (this.defaultFont != defaultFont || this.defaultMonospaceFont != defaultMonospaceFont) { this.defaultFont = defaultFont; this.defaultMonospaceFont = defaultMonospaceFont; if (scanner != null) { scanner.resetFonts(defaultFont, defaultMonospaceFont); } } }
public Composite createPartControl(Composite parent) { content = new Composite(parent, SWT.NONE); RowLayout rowLayout = new RowLayout(); rowLayout.wrap = true; rowLayout.pack = true; rowLayout.fill = true; rowLayout.justify = false; rowLayout.type = SWT.HORIZONTAL; rowLayout.marginLeft = 2; rowLayout.marginTop = 2; rowLayout.marginRight = 2; rowLayout.marginBottom = 2; rowLayout.spacing = 3; content.setLayout(rowLayout); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); themeManager.addPropertyChangeListener(themeChangeListener); ITheme theme = themeManager.getCurrentTheme(); setTheme(theme); content.addMouseListener(mouseListener); return content; }
@Override public void createPartControl(Composite parent) { Composite menuOntologic = new Composite(parent, SWT.NONE); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); Color col = themeManager .getTheme("org.dafoe.ontologiclevel.themeId") .getColorRegistry() .get("org.dafoe.application.backcolor"); menuOntologic.setBackground(col); menuOntologic.setLayout(new GridLayout(3, false)); Button classes = new Button(menuOntologic, SWT.FLAT); classes.setText(Messages.getString("OntologicMenuViewPart.1")); // $NON-NLS-1$ classes.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { List<String> perpsectiveIdsFromContextLevel = Activator.getDefault() .getContextLevel() .getPerpsectiveIdsFromContextLevel("ontologic"); System.out.println(perpsectiveIdsFromContextLevel.size()); IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor perspectiveWithId = perspectiveRegistry.findPerspectiveWithId(perpsectiveIdsFromContextLevel.get(0)); PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .setPerspective(perspectiveWithId); } }); Button objectProperties = new Button(menuOntologic, SWT.FLAT); objectProperties.setText(Messages.getString("OntologicMenuViewPart.2")); // $NON-NLS-1$ objectProperties.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { List<String> perpsectiveIdsFromContextLevel = Activator.getDefault() .getContextLevel() .getPerpsectiveIdsFromContextLevel("ontologic"); IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor perspectiveWithId = perspectiveRegistry.findPerspectiveWithId(perpsectiveIdsFromContextLevel.get(1)); PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .setPerspective(perspectiveWithId); } }); Button individuals = new Button(menuOntologic, SWT.FLAT); individuals.setText(Messages.getString("OntologicMenuViewPart.3")); // $NON-NLS-1$ individuals.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { List<String> perpsectiveIdsFromContextLevel = Activator.getDefault() .getContextLevel() .getPerpsectiveIdsFromContextLevel("ontologic"); IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor perspectiveWithId = perspectiveRegistry.findPerspectiveWithId(perpsectiveIdsFromContextLevel.get(2)); PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .setPerspective(perspectiveWithId); } }); }
public void createPartControl(Composite parent) { SashForm sash = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH); queryViewer = new SourceViewer(sash, null, SWT.MULTI | SWT.WRAP); queryString = queryViewer.getTextWidget(); queryString.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); Color background = queryString.getBackground(); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); ITheme current = themeManager.getCurrentTheme(); ColorRegistry colorRegistry = current.getColorRegistry(); commentCol = colorRegistry.get(ColorProvider.COMMENT_COLOR_PREF); keywordCol = colorRegistry.get(ColorProvider.KEYWORD_COLOR_PREF); IDocument d = createDocument(); d.set(Messages.OQLPane_F1ForHelp); queryViewer.addSelectionChangedListener( new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateActions(); } }); queryViewer.setDocument(d); queryViewer.configure(new OQLTextViewerConfiguration(getSnapshot(), commentCol, keywordCol)); // Eclipse 4 seems to need this otherwise in high contrast mode the background is white queryString.setBackground(background); queryString.selectAll(); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(queryString, "org.eclipse.mat.ui.help.oql"); // $NON-NLS-1$ queryString.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.keyCode == '\r' && (e.stateMask & SWT.MOD1) != 0) { executeAction.run(); e.doit = false; } else if (e.keyCode == ' ' && (e.stateMask & SWT.CTRL) != 0) { // ctrl space combination for content assist contentAssistAction.run(); } else if (e.keyCode == SWT.F5) { executeAction.run(); e.doit = false; } } }); queryString.addFocusListener( new FocusListener() { public void focusGained(FocusEvent e) { IActionBars actionBars = getEditor().getEditorSite().getActionBars(); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyQueryStringAction); actionBars.updateActionBars(); } public void focusLost(FocusEvent e) {} }); queryString.setFocus(); createContainer(sash); sash.setWeights(new int[] {1, 4}); makeActions(); hookContextMenu(); }