List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt
int getInt(String name);
From source file:descent.internal.ui.navigator.PackageExplorerActionProvider.java
License:Open Source License
private void restoreLayoutState(IMemento memento) { boolean isCurrentLayoutFlat = true; Integer state = null;/* w w w .j av a 2 s. c om*/ if (memento != null) state = memento.getInteger(TAG_LAYOUT); // If no memento try an restore from preference store if (state == null) { IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore(); state = new Integer(store.getInt(TAG_LAYOUT)); } if (state.intValue() == FLAT_LAYOUT) isCurrentLayoutFlat = true; else if (state.intValue() == HIERARCHICAL_LAYOUT) isCurrentLayoutFlat = false; fStateModel.setBooleanProperty(Values.IS_LAYOUT_FLAT, isCurrentLayoutFlat); fLayoutActionGroup.setFlatLayout(isCurrentLayoutFlat); }
From source file:descent.internal.ui.preferences.JavaPreferencesSettings.java
License:Open Source License
/** * @deprecated Use getImportNumberThreshold(IJavaProject) instead *//*www. j a v a 2 s. co m*/ public static int getImportNumberThreshold(IPreferenceStore prefs) { int threshold = prefs.getInt(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD); if (threshold < 0) { threshold = Integer.MAX_VALUE; } return threshold; }
From source file:descent.internal.ui.preferences.TemplateEditorSourceViewerConfiguration.java
License:Open Source License
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore(); JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools(); IColorManager manager = textTools.getColorManager(); ContentAssistant assistant = new ContentAssistant(); assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE); // Register the same processor for strings and single line comments to get code completion at the start of those partitions. assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_STRING); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_PRAGMA); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_CHARACTER); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_SINGLE_LINE_DOC_COMMENT); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_MULTI_LINE_COMMENT); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_MULTI_LINE_PLUS_COMMENT); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_MULTI_LINE_PLUS_DOC_COMMENT); assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_DOC); assistant.enableAutoInsert(store.getBoolean(PreferenceConstants.CODEASSIST_AUTOINSERT)); assistant.enableAutoActivation(store.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION)); assistant.setAutoActivationDelay(store.getInt(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY)); assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY); assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE); assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); Color background = getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, manager); assistant.setContextInformationPopupBackground(background); assistant.setContextSelectorBackground(background); assistant.setProposalSelectorBackground(background); Color foreground = getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, manager); assistant.setContextInformationPopupForeground(foreground); assistant.setContextSelectorForeground(foreground); assistant.setProposalSelectorForeground(foreground); return assistant; }
From source file:descent.internal.ui.text.ContentAssistPreference.java
License:Open Source License
/** * Configure the given content assistant from the given store. *///from w w w . ja va2 s . c o m public static void configure(ContentAssistant assistant, IPreferenceStore store) { JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools(); IColorManager manager = textTools.getColorManager(); boolean enabled = store.getBoolean(AUTOACTIVATION); assistant.enableAutoActivation(enabled); int delay = store.getInt(AUTOACTIVATION_DELAY); assistant.setAutoActivationDelay(delay); Color c = getColor(store, PROPOSALS_FOREGROUND, manager); assistant.setProposalSelectorForeground(c); c = getColor(store, PROPOSALS_BACKGROUND, manager); assistant.setProposalSelectorBackground(c); c = getColor(store, PARAMETERS_FOREGROUND, manager); assistant.setContextInformationPopupForeground(c); assistant.setContextSelectorForeground(c); c = getColor(store, PARAMETERS_BACKGROUND, manager); assistant.setContextInformationPopupBackground(c); assistant.setContextSelectorBackground(c); enabled = store.getBoolean(AUTOINSERT); assistant.enableAutoInsert(enabled); enabled = store.getBoolean(PREFIX_COMPLETION); assistant.enablePrefixCompletion(enabled); // TODO JDT UI fix colored labels // enabled= store.getBoolean(USE_COLORED_LABELS); assistant.enableColoredLabels(true); configureJavaProcessor(assistant, store); configureJavaDocProcessor(assistant, store); }
From source file:eclox.ui.BuildManager.java
License:Open Source License
/** * Launches the build of the given doxyfile. * * @param doxyfile the doxyfile to build *//*from w ww .j a v a 2s . c o m*/ public void build(Doxyfile doxyfile) { // Retrieves the plug-in preferences. IPreferenceStore preferences = Plugin.getDefault().getPreferenceStore(); // Ask the user if he wants to save all opened editors before proceeding to build. final String autoSave = preferences.getString(IPreferences.AUTO_SAVE); if (autoSave.equals(IPreferences.AUTO_SAVE_ALWAYS)) { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(false); } else if (autoSave.equals(IPreferences.AUTO_SAVE_ASK)) { boolean saved; saved = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(true); if (saved == false) { return; } } else if (autoSave.equals(IPreferences.AUTO_SAVE_NEVER)) { // Nothing to perform. } else { // Not supported. assert (false); Plugin.log(autoSave + ": unsupported auto save state."); } // Retrieves the build job for the given doxyfile. BuildJob job = BuildJob.getJob(doxyfile); // Attaches a listener if applicable. if (jobHistory.contains(job) == false) { job.addBuidJobListener(new MyJobListener()); } // Updates the job history. int preferedHistorySize = preferences.getInt(IPreferences.BUILD_HISTORY_SIZE); jobHistory.remove(job); if (jobHistory.size() >= preferedHistorySize && jobHistory.isEmpty() == false) { jobHistory.remove(0); } jobHistory.add(job); // Updates the console. Console.show(job); // Schedule the job to build. job.schedule(1000); }
From source file:edu.toronto.cs.se.mmint.mid.diagram.providers.MIDDiagramViewProvider.java
License:Open Source License
/** * Customizes label creation.//from w ww. ja va 2s . c om */ @SuppressWarnings("unchecked") @Override public Edge createModelEndpoint_4002(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Edge edge = NotationFactory.eINSTANCE.createEdge(); edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle()); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(MIDVisualIDRegistry.getType(ModelEndpointEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } if (!Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_MODELRELENDPOINTS_ENABLED))) { return edge; } Node label6001 = createLabel(edge, MIDVisualIDRegistry.getType(WrappingLabel10EditPart.VISUAL_ID)); label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6001 = (Location) label6001.getLayoutConstraint(); location6001.setX(0); location6001.setY(40); if (Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_ICONS_ENABLED))) { Node label6002 = createLabel(edge, MIDVisualIDRegistry.getType(WrappingLabel11EditPart.VISUAL_ID)); label6002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6002 = (Location) label6002.getLayoutConstraint(); location6002.setX(0); location6002.setY(60); } return edge; }
From source file:edu.toronto.cs.se.mmint.mid.diagram.providers.MIDDiagramViewProvider.java
License:Open Source License
/** * Customizes label creation.//w w w. j av a 2 s. com */ @SuppressWarnings("unchecked") @Override public Edge createModelEndpoint_4004(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Edge edge = NotationFactory.eINSTANCE.createEdge(); edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle()); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(MIDVisualIDRegistry.getType(ModelEndpoint2EditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } if (!Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_OPERATORENDPOINTS_ENABLED))) { return edge; } Node label6007 = createLabel(edge, MIDVisualIDRegistry.getType(ModelEndpointNameEditPart.VISUAL_ID)); label6007.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6007 = (Location) label6007.getLayoutConstraint(); location6007.setX(0); location6007.setY(40); return edge; }
From source file:edu.toronto.cs.se.mmint.mid.diagram.providers.MIDDiagramViewProvider.java
License:Open Source License
/** * Customizes label creation.//from w ww . j a va2 s . c o m */ @SuppressWarnings("unchecked") @Override public Edge createModelEndpoint_4005(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Edge edge = NotationFactory.eINSTANCE.createEdge(); edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle()); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(MIDVisualIDRegistry.getType(ModelEndpoint3EditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } if (!Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_OPERATORENDPOINTS_ENABLED))) { return edge; } Node label6008 = createLabel(edge, MIDVisualIDRegistry.getType(ModelEndpointName2EditPart.VISUAL_ID)); label6008.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6008 = (Location) label6008.getLayoutConstraint(); location6008.setX(0); location6008.setY(40); return edge; }
From source file:edu.toronto.cs.se.mmint.mid.diagram.providers.MIDDiagramViewProvider.java
License:Open Source License
/** * Customizes label creation.//from w w w . j a v a2 s .c o m */ @SuppressWarnings("unchecked") private Edge _createBinaryModelRel_4003(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Edge edge = NotationFactory.eINSTANCE.createEdge(); edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle()); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(MIDVisualIDRegistry.getType(BinaryModelRelEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } if (!Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_MODELRELS_ENABLED))) { return edge; } Node label6003 = createLabel(edge, MIDVisualIDRegistry.getType(WrappingLabel12EditPart.VISUAL_ID)); label6003.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6003 = (Location) label6003.getLayoutConstraint(); location6003.setX(0); location6003.setY(40); if (Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_ICONS_ENABLED))) { Node label6004 = createLabel(edge, MIDVisualIDRegistry.getType(WrappingLabel13EditPart.VISUAL_ID)); label6004.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6004 = (Location) label6004.getLayoutConstraint(); location6004.setX(0); location6004.setY(60); } if (!Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_MODELRELENDPOINTS_ENABLED))) { return edge; } Node label6005 = createLabel(edge, MIDVisualIDRegistry.getType(WrappingLabel14EditPart.VISUAL_ID)); label6005.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6005 = (Location) label6005.getLayoutConstraint(); location6005.setX(0); location6005.setY(80); Node label6006 = createLabel(edge, MIDVisualIDRegistry.getType(WrappingLabel15EditPart.VISUAL_ID)); label6006.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); Location location6006 = (Location) label6006.getLayoutConstraint(); location6006.setX(0); location6006.setY(100); return edge; }
From source file:edu.toronto.cs.se.mmint.mid.diagram.providers.MIDViewProvider.java
License:Open Source License
/** * @generated/*w w w .j a v a2s . c om*/ */ public Edge createExtendibleElementSupertype_4001(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Edge edge = NotationFactory.eINSTANCE.createEdge(); edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle()); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(MIDVisualIDRegistry.getType(ExtendibleElementSupertypeEditPart.VISUAL_ID)); edge.setElement(null); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } return edge; }