List of usage examples for org.eclipse.jface.preference IPreferenceStore getString
String getString(String name);
From source file:com.bdaum.zoom.ui.internal.views.AbstractLightboxView.java
License:Open Source License
protected IPreferenceStore applyPreferences() { final IPreferenceStore preferenceStore = UiActivator.getDefault().getPreferenceStore(); showLabelDflt = preferenceStore.getInt(PreferenceConstants.SHOWLABEL); labelTemplateDflt = preferenceStore.getString(PreferenceConstants.THUMBNAILTEMPLATE); labelFontsizeDflt = preferenceStore.getInt(PreferenceConstants.LABELFONTSIZE); showRotateButtons = preferenceStore.getBoolean(PreferenceConstants.SHOWROTATEBUTTONS); showColorCode = !PreferenceConstants.COLORCODE_NO .equals(preferenceStore.getString(PreferenceConstants.SHOWCOLORCODE)); showLocation = preferenceStore.getBoolean(PreferenceConstants.SHOWLOCATION); String rating = preferenceStore.getString(PreferenceConstants.SHOWRATING); showRating = PreferenceConstants.SHOWRATING_NO.equals(rating) ? RATING_NO : PreferenceConstants.SHOWRATING_COUNT.equals(rating) ? RATING_COUNT : RATING_SIZE; showDoneMark = preferenceStore.getBoolean(PreferenceConstants.SHOWDONEMARK); showVoicenoteButton = preferenceStore.getBoolean(PreferenceConstants.SHOWVOICENOTE); showExpandCollapseButton = preferenceStore.getBoolean(PreferenceConstants.SHOWEXPANDCOLLAPSE); showRegions = preferenceStore.getInt(PreferenceConstants.MAXREGIONS); return preferenceStore; }
From source file:com.bdaum.zoom.ui.internal.views.ZuiView.java
License:Open Source License
protected IPreferenceStore applyPreferences() { final IPreferenceStore preferenceStore = UiActivator.getDefault().getPreferenceStore(); showLabelDflt = preferenceStore.getInt(PreferenceConstants.SHOWLABEL); labelTemplateDflt = preferenceStore.getString(PreferenceConstants.THUMBNAILTEMPLATE); labelFontsizeDflt = preferenceStore.getInt(PreferenceConstants.LABELFONTSIZE); return preferenceStore; }
From source file:com.bdaum.zoom.ui.internal.widgets.AnimatedGallery.java
License:Open Source License
protected IPreferenceStore applyPreferences() { final IPreferenceStore preferenceStore = UiActivator.getDefault().getPreferenceStore(); showRotateButtons = preferenceStore.getBoolean(PreferenceConstants.SHOWROTATEBUTTONS); showColorCode = !PreferenceConstants.COLORCODE_NO .equals(preferenceStore.getString(PreferenceConstants.SHOWCOLORCODE)); showLocation = preferenceStore.getBoolean(PreferenceConstants.SHOWLOCATION); String rating = preferenceStore.getString(PreferenceConstants.SHOWRATING); showRating = PreferenceConstants.SHOWRATING_NO.equals(rating) ? RATING_NO : PreferenceConstants.SHOWRATING_COUNT.equals(rating) ? RATING_COUNT : RATING_SIZE; showDoneMark = preferenceStore.getBoolean(PreferenceConstants.SHOWDONEMARK); showVoicenoteButton = preferenceStore.getBoolean(PreferenceConstants.SHOWVOICENOTE); showRegions = preferenceStore.getInt(PreferenceConstants.MAXREGIONS); return preferenceStore; }
From source file:com.blackducksoftware.integration.eclipseplugin.common.services.PreferencesServiceTest.java
License:Apache License
@Test public void testSetDefaultConfig() { final IPreferenceStore mockPrefStore = new PreferenceStoreMock(); final PreferencesService service = new PreferencesService(mockPrefStore); service.setDefaultConfig();/*from w w w . java 2s . c o m*/ assertEquals("Default behavior is not to activate Black Duck scan by default", mockPrefStore.getString(PreferenceNames.ACTIVATE_SCAN_BY_DEFAULT), "true"); }
From source file:com.blackducksoftware.integration.eclipseplugin.internal.ProjectDependencyInformation.java
License:Apache License
public void phoneHome() throws HubIntegrationException { if (!Activator.getPlugin().getConnectionService().hasActiveHubConnection()) { return;/* w w w . j ava 2s.c o m*/ } PhoneHomeDataService phoneHomeService = Activator.getPlugin().getConnectionService() .getPhoneHomeDataService(); HubVersionRequestService hubVersionRequestService = Activator.getPlugin().getConnectionService() .getHubVersionRequestService(); String hubVersion = hubVersionRequestService.getHubVersion(); IProduct eclipseProduct = Platform.getProduct(); String eclipseVersion = eclipseProduct.getDefiningBundle().getVersion().toString(); String pluginVersion = Platform.getBundle("hub-eclipse-plugin").getVersion().toString(); AuthorizationValidator authorizationValidator = new AuthorizationValidator( Activator.getPlugin().getConnectionService(), new HubServerConfigBuilder()); SecurePreferencesService securePrefService = new SecurePreferencesService(SecurePreferenceNodes.BLACK_DUCK, SecurePreferencesFactory.getDefault()); IPreferenceStore prefStore = Activator.getPlugin().getPreferenceStore(); String username = prefStore.getString(PreferenceNames.HUB_USERNAME); String password = securePrefService.getSecurePreference(SecurePreferenceNames.HUB_PASSWORD); String hubUrl = prefStore.getString(PreferenceNames.HUB_URL); String proxyUsername = prefStore.getString(PreferenceNames.PROXY_USERNAME); String proxyPassword = securePrefService.getSecurePreference(SecurePreferenceNames.PROXY_PASSWORD); String proxyPort = prefStore.getString(PreferenceNames.PROXY_PORT); String proxyHost = prefStore.getString(PreferenceNames.PROXY_HOST); String ignoredProxyHosts = prefStore.getString(PreferenceNames.IGNORED_PROXY_HOSTS); String timeout = prefStore.getString(PreferenceNames.HUB_TIMEOUT); authorizationValidator.setHubServerConfigBuilderFields(username, password, hubUrl, proxyUsername, proxyPassword, proxyPort, proxyHost, ignoredProxyHosts, timeout); HubServerConfig hubServerConfig = authorizationValidator.getHubServerConfigBuilder().build(); phoneHomeService.phoneHome(hubServerConfig, ThirdPartyName.ECLIPSE, eclipseVersion, pluginVersion, hubVersion); }
From source file:com.blackducksoftware.integration.eclipseplugin.startup.Activator.java
License:Apache License
public RestConnection getInitialHubConnection() throws HubIntegrationException { IPreferenceStore prefs = getPlugin().getPreferenceStore(); String hubURL = prefs.getString(PreferenceNames.HUB_URL); String hubUsername = prefs.getString(PreferenceNames.HUB_USERNAME); String hubPassword = securePrefService.getSecurePreference(SecurePreferenceNames.HUB_PASSWORD); String hubTimeout = prefs.getString(PreferenceNames.HUB_TIMEOUT); String proxyUsername = prefs.getString(PreferenceNames.PROXY_USERNAME); String proxyPassword = securePrefService.getSecurePreference(SecurePreferenceNames.PROXY_PASSWORD); String proxyPort = prefs.getString(PreferenceNames.PROXY_PORT); String proxyHost = prefs.getString(PreferenceNames.PROXY_HOST); String ignoredProxyHosts = prefs.getString(PreferenceNames.IGNORED_PROXY_HOSTS); HubServerConfigBuilder builder = new HubServerConfigBuilder(); HubRestConnectionService connectionService = new HubRestConnectionService(); AuthorizationValidator validator = new AuthorizationValidator(connectionService, builder); AuthorizationResponse response = validator.validateCredentials(hubUsername, hubPassword, hubURL, proxyUsername, proxyPassword, proxyPort, proxyHost, ignoredProxyHosts, hubTimeout); if (response.getConnection() != null) { return response.getConnection(); } else {/*from w ww . j ava 2 s . co m*/ return null; } }
From source file:com.bluexml.side.util.dependencies.WorkbenchPreferencePage1.java
License:Open Source License
public static String getLocationPreference() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String locationPreference = store.getString(MAVEN_REPO_LOCATION); if (StringUtils.trimToNull(locationPreference) == null) { locationPreference = RepositorySystem.defaultUserLocalRepository.toString(); }//w ww . j a va 2s. c om return locationPreference; }
From source file:com.bluexml.side.util.dependencies.WorkbenchPreferencePage1.java
License:Open Source License
public static String getLastRepoVersion(String repoId) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); return store.getString(getPreferencesIdForRepo(repoId)); }
From source file:com.bmw.spdxeditor.SPDXPreferencesPage.java
License:Apache License
@Override protected Control createContents(Composite parent) { IPreferenceStore store = getPreferenceStore(); String fileCreatorValue = store.getString(DEFAULT_FILE_CREATOR); String fileCreatorType = null; if (StringUtils.isEmpty(fileCreatorValue)) { fileCreatorValue = "NOASSERTION"; fileCreatorType = ""; } else {/*w w w. j a v a 2 s . c o m*/ fileCreatorType = StringUtils.substringBefore(fileCreatorValue, ":"); fileCreatorValue = StringUtils.substringAfter(fileCreatorValue, ":").trim(); } // Describe layout for this group panel GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; parent.setLayout(gridLayout); Label lbl = new Label(parent, SWT.NONE); lbl.setText("Package creator default"); // Person, Organization, Tool String items[] = { "Person", "Organization", "Tool", "" }; creatorTypes = new Combo(parent, SWT.READ_ONLY); creatorTypes.setItems(items); creatorTypes.setText(fileCreatorType); creatorText = new Text(parent, SWT.BORDER); creatorText.setText(fileCreatorValue); return null; }
From source file:com.brosinski.eclipse.regex.view.RegExView.java
License:Open Source License
public void createPartControl(final Composite parent) { makeActions();//from w w w. j a v a 2 s . c o m GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; parent.setLayout(gridLayout); GridData gridData = new GridData(); parent.setLayoutData(gridData); lbl_RegExp = new Label(parent, SWT.LEFT); lbl_RegExp.setText("Regular Expression"); txt_RegExp = new StyledText(parent, SWT.LEFT | SWT.BORDER | SWT.SINGLE); txt_RegExp.addKeyListener(new BracketMatchingKeyAdapter()); txt_RegExp.addKeyListener(new AssistKeyAdapter()); // GRO: Store/Restore last input value from PreferenceStore IPreferenceStore preferenceStore = RegExPlugin.getDefault().getPreferenceStore(); String preferenceKey = "txt_RegExp"; txt_RegExp.addFocusListener(new SaveLastValueToPreferenceStoreFocusAdapter(preferenceStore, preferenceKey)); txt_RegExp.setText(preferenceStore.getString(preferenceKey)); txt_RegExp.addFocusListener(new FocusListener() { private int caretOffset; public void focusGained(FocusEvent e) { ((StyledText) e.widget).setCaretOffset(caretOffset); } public void focusLost(FocusEvent e) { caretOffset = ((StyledText) e.widget).getCaretOffset(); } }); txt_RegExp.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.regex.name"), prefs.getInt("font.regex.height"), prefs.getInt("font.regex.style")))); txt_RegExp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); txt_RegExp.setMenu(new Menu(parent.getShell())); setTextMenuItems(txt_RegExp); new MenuItem(txt_RegExp.getMenu(), SWT.BAR); setPatternFlagMenu(txt_RegExp.getMenu()); txt_RegExp.getMenu().addMenuListener(new MenuListener() { public void menuHidden(MenuEvent e) { } public void menuShown(MenuEvent e) { if (txt_RegExp.getSelectionCount() > 0) { mit_EvalSelection.setEnabled(true); } else { mit_EvalSelection.setEnabled(false); } } }); // RegEx Menu: Match Mode men_MatchMode = new Menu(txt_RegExp.getMenu()); mit_MatchMode = new MenuItem(txt_RegExp.getMenu(), SWT.CASCADE); mit_MatchMode.setText("Match mode"); mit_MatchMode.setMenu(men_MatchMode); mit_mFind = new MenuItem(men_MatchMode, SWT.RADIO); mit_mFind.setText("Find sequence"); mit_mFind.setData(new Integer(RegExModel.MODE_FIND)); mit_mFind.setSelection(true); mit_mFind.addSelectionListener(this); mit_mMatch = new MenuItem(men_MatchMode, SWT.RADIO); mit_mMatch.setText("Match complete text"); mit_mMatch.setData(new Integer(RegExModel.MODE_MATCH)); mit_mMatch.addSelectionListener(this); mit_mSplit = new MenuItem(men_MatchMode, SWT.RADIO); mit_mSplit.setText("Split"); mit_mSplit.setData(new Integer(RegExModel.MODE_SPLIT)); mit_mSplit.addSelectionListener(this); mit_mReplace = new MenuItem(men_MatchMode, SWT.RADIO); mit_mReplace.setText("Replace..."); mit_mReplace.setData(new Integer(RegExModel.MODE_REPLACE)); mit_mReplace.addSelectionListener(this); // RegEx Menu Item: Copy As String Literal mit_CopyLiteral = new MenuItem(txt_RegExp.getMenu(), SWT.NONE); mit_CopyLiteral.setText("Copy As String &Literal"); mit_CopyLiteral.addSelectionListener(this); mit_PasteLiteral = new MenuItem(txt_RegExp.getMenu(), SWT.NONE); mit_PasteLiteral.setText("&Paste String Literal"); mit_PasteLiteral.addSelectionListener(this); new MenuItem(txt_RegExp.getMenu(), SWT.BAR); mit_EvalSelection = new MenuItem(txt_RegExp.getMenu(), SWT.NONE); mit_EvalSelection.setText("Eval Selection Only"); mit_EvalSelection.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { regex.setRegExp(txt_RegExp.getSelectionText()); regex.setSearchText(txt_SearchText.getText()); regex.process(); } public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); SashForm sashForm = new SashForm(parent, SWT.VERTICAL); sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); txt_SearchText = new StyledText(sashForm, SWT.LEFT | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); txt_SearchText.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.searchtext.name"), prefs.getInt("font.searchtext.height"), prefs.getInt("font.searchtext.style")))); txt_SearchText.setWordWrap(true); txt_SearchText.setLayoutData(new GridData(GridData.FILL_BOTH)); txt_SearchText.addVerifyKeyListener(new VerifyKeyListener() { public void verifyKey(VerifyEvent event) { if (event.keyCode == SWT.TAB) { txt_RegExp.setCaretOffset(currentCarresPos); currentCarresPos = txt_SearchText.getCaretOffset(); txt_RegExp.setFocus(); event.doit = false; } } }); txt_SearchText.setMenu(new Menu(parent.getShell())); setTextMenuItems(txt_SearchText); // GRO: Store/Restore last input value from PreferenceStore preferenceKey = "txt_SearchText"; txt_SearchText .addFocusListener(new SaveLastValueToPreferenceStoreFocusAdapter(preferenceStore, preferenceKey)); txt_SearchText.setText(preferenceStore.getString(preferenceKey)); txt_Result = new StyledText(sashForm, SWT.LEFT | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER | SWT.READ_ONLY); txt_Result.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.result.name"), prefs.getInt("font.result.height"), prefs.getInt("font.result.style")))); txt_Result.setWordWrap(true); txt_Result.setLayoutData(new GridData(GridData.FILL_BOTH)); txt_Result.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); txt_Result.setMenu(new Menu(parent.getShell())); setTextMenuItems(txt_Result); cmp_ButtonGroup = new Composite(parent, 0); RowLayout buttonRow = new RowLayout(); buttonRow.pack = false; buttonRow.marginLeft = 0; buttonRow.spacing = 20; cmp_ButtonGroup.setLayout(buttonRow); btn_Find = new Button(cmp_ButtonGroup, SWT.CENTER | SWT.FLAT); btn_Find.setText("&Find"); btn_Find.addSelectionListener(this); liveEval = new LiveEval(txt_RegExp, txt_SearchText); liveEval.addLiveEvalListener(this); btn_LiveEval = new Button(cmp_ButtonGroup, SWT.CHECK | SWT.FLAT); btn_LiveEval.setText("&Live Evaluation"); if (prefs.getBoolean("EvalSwitch")) { btn_LiveEval.setSelection(true); liveEval.start(); } btn_LiveEval.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Button check = (Button) e.widget; if (check.getSelection()) { liveEval.start(); } else { liveEval.stop(); } } }); StyledTextActionHandler styledTextActionHandler = new StyledTextActionHandler( this.getViewSite().getActionBars()); styledTextActionHandler.addStyledText(txt_RegExp); styledTextActionHandler.addStyledText(txt_SearchText); styledTextActionHandler.addStyledText(txt_Result); if (liveEval.isLiveEval()) { processRegEx(); updateFoundStatus(); } }