List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.vectrace.MercurialEclipse.preferences.ConsolePreferencesPage.java
License:Open Source License
@Override protected void createFieldEditors() { final Composite composite = getFieldEditorParent(); createLabel(composite, Messages.getString("ConsolePreferencesPage.header")); //$NON-NLS-1$ IPreferenceStore store = getPreferenceStore(); // ** WRAP/*w w w. j a v a 2 s.co m*/ wrap = new BooleanFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_WRAP, Messages.getString("ConsolePreferencesPage.wrapText"), //$NON-NLS-1$ composite); addField(wrap); width = new IntegerFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_WIDTH, Messages.getString("ConsolePreferencesPage.consoleWidth"), composite); //$NON-NLS-1$ addField(width); // ** RESTRICT OUTPUT restrictOutput = new BooleanFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_LIMIT_OUTPUT, Messages.getString("ConsolePreferencesPage.limitOutput"), composite); //$NON-NLS-1$ addField(restrictOutput); highWaterMark = new IntegerFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_HIGH_WATER_MARK, Messages.getString("ConsolePreferencesPage.numberChars"), composite); // ) //$NON-NLS-1$ addField(highWaterMark); // ** SHOW AUTOMATICALLY showOnMessage = new BooleanFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_SHOW_ON_MESSAGE, Messages.getString("ConsolePreferencesPage.showConsoleOnMsg"), composite); //$NON-NLS-1$ addField(showOnMessage); // ** show on startup showOnStartup = new BooleanFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_SHOW_ON_STARTUP, "Show console on start-up", composite); //$NON-NLS-1$ addField(showOnStartup); // ** SHOW DEBUG debug = new BooleanFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_DEBUG, Messages.getString("ConsolePreferencesPage.showAllHgMsg"), composite); //$NON-NLS-1$ addField(debug); // ** SHOW TIME debugTime = new BooleanFieldEditor(MercurialPreferenceConstants.PREF_CONSOLE_DEBUG_TIME, Messages.getString("ConsolePreferencesPage.showCommandExecutionTime"), composite); //$NON-NLS-1$ addField(debugTime); createLabel(composite, Messages.getString("ConsolePreferencesPage.colorPrefs")); //$NON-NLS-1$ // ** COLORS AND FONTS commandColorEditor = SWTWidgetHelper.createColorFieldEditor( MercurialPreferenceConstants.PREF_CONSOLE_COMMAND_COLOR, Messages.getString("ConsolePreferencesPage.cmdColor"), composite, this, getPreferenceStore()); //$NON-NLS-1$ addField(commandColorEditor); messageColorEditor = SWTWidgetHelper.createColorFieldEditor( MercurialPreferenceConstants.PREF_CONSOLE_MESSAGE_COLOR, Messages.getString("ConsolePreferencesPage.msgColor"), composite, this, getPreferenceStore()); //$NON-NLS-1$ addField(messageColorEditor); errorColorEditor = SWTWidgetHelper.createColorFieldEditor( MercurialPreferenceConstants.PREF_CONSOLE_ERROR_COLOR, Messages.getString("ConsolePreferencesPage.errorColor"), composite, this, getPreferenceStore()); //$NON-NLS-1$ addField(errorColorEditor); //initIntegerFields(); width.setEnabled(store.getBoolean(MercurialPreferenceConstants.PREF_CONSOLE_WRAP), composite); highWaterMark.setEnabled(store.getBoolean(MercurialPreferenceConstants.PREF_CONSOLE_LIMIT_OUTPUT), composite); Dialog.applyDialogFont(composite); }
From source file:com.vectrace.MercurialEclipse.preferences.PreferenceInitializer.java
License:Open Source License
private static void detectAndSetHgExecutable(IPreferenceStore store) { // Currently only tested on Windows. The binary is expected to be found // at "os\win32\x86\hg.exe" (relative to the plugin/fragment directory) File hgExecutable = getIntegratedHgExecutable(); String defaultExecPath;/*from w ww. jav a 2 s. c o m*/ String existingValue = store.getString(MERCURIAL_EXECUTABLE); // Use built in if possible if (store.getBoolean(USE_BUILT_IN_HG_EXECUTABLE) && hgExecutable != null) { defaultExecPath = hgExecutable.getPath(); store.setValue(MERCURIAL_EXECUTABLE, defaultExecPath); store.setDefault(MERCURIAL_EXECUTABLE, defaultExecPath); return; } // Future: Should we ignore the integrated executable if the pref is disabled? if (hgExecutable == null) { hgExecutable = checkForPossibleHgExecutables(); } if (hgExecutable == null) { defaultExecPath = "hg"; } else { defaultExecPath = hgExecutable.getPath(); } if (existingValue != null && !new File(existingValue).isFile()) { // If already set override if it's invalid store.setValue(MERCURIAL_EXECUTABLE, defaultExecPath); } store.setDefault(MERCURIAL_EXECUTABLE, defaultExecPath); }
From source file:com.vectrace.MercurialEclipse.synchronize.actions.PushPullSynchronizeOperation.java
License:Open Source License
private void checkChangesets(final IProgressMonitor monitor, int csCount, RepositoryChangesetGroup rcGroup) { if (csCount < 1) { // paranoia... monitor.setCanceled(true);//from www . ja va 2 s.com return; } final String title; final String message; // // Get the repo logical name in order to embed it in the message shown to the user. // IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); boolean showRepoLogicalName = store .getBoolean(MercurialPreferenceConstants.PREF_SHOW_LOGICAL_NAME_OF_REPOSITORIES); String repoName = ""; if (rcGroup.getRoot() != null && showRepoLogicalName) { IHgRepositoryLocation repoLocation = participant.getRepositoryLocation(rcGroup.getRoot()); if (!StringUtils.isEmpty(repoLocation.getLogicalName())) { repoName = " ([" + repoLocation.getLogicalName() + "])"; } } // if (isPull) { title = "Hg Pull"; message = "Pulling " + csCount + " changesets (or more) from the remote repository" + repoName + ".\n" + "The pull will fetch the *latest* version available remotely.\n" + "Continue?"; } else { if (csCount == 1) { return; } title = "Hg Push"; message = "Pushing " + csCount + " changesets to the remote repository" + repoName + ". Continue?"; } getShell().getDisplay().syncExec(new Runnable() { public void run() { if (!MercurialEclipsePlugin.showDontShowAgainConfirmDialog(title, message, MessageDialog.CONFIRM, MercurialPreferenceConstants.PREF_SHOW_PULL_WARNING_DIALOG, getShell())) { monitor.setCanceled(true); } } }); }
From source file:com.vectrace.MercurialEclipse.synchronize.MercurialSynchronizeParticipant.java
License:Open Source License
/** * Computes the label that is displayed as the title, below the "Synchronize" tab label. This * text is different from the secondary ID only in the fact that repo logical names are * included, provided that the user has enabled the appropriate preference setting. * * @return the URI to the repository against which the synchronization is done, possibly * prefixed with the logical name. *///from ww w . java 2 s . co m private static String computeSynchronizationViewTitle(RepositorySynchronizationScope scope, RepositoryLocationMap repos) { IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); boolean showRepoLogicalName = store .getBoolean(MercurialPreferenceConstants.PREF_SHOW_LOGICAL_NAME_OF_REPOSITORIES); IProject[] projects = scope.getProjects(); StringBuilder sb = new StringBuilder(); if (projects.length > 0) { sb.append("["); for (IHgRepositoryLocation repo : repos.getLocations()) { if (showRepoLogicalName && !StringUtils.isEmpty(repo.getLogicalName())) { sb.append('['); sb.append(repo.getLogicalName()); sb.append("] "); } sb.append(repo.getLocation()).append(','); } sb.deleteCharAt(sb.length() - 1); sb.append("] "); } return sb.toString(); }
From source file:com.vectrace.MercurialEclipse.synchronize.MercurialSynchronizeSubscriber.java
License:Open Source License
public MercurialSynchronizeSubscriber(RepositorySynchronizationScope synchronizationScope) { Assert.isNotNull(synchronizationScope); scope = synchronizationScope;//from www.j a va 2 s . c om synchronizationScope.setSubscriber(this); final IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); computeFullState = store.getBoolean(SYNC_COMPUTE_FULL_REMOTE_FILE_STATUS); store.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (SYNC_COMPUTE_FULL_REMOTE_FILE_STATUS.equals(event.getProperty())) { computeFullState = store.getBoolean(SYNC_COMPUTE_FULL_REMOTE_FILE_STATUS); } } }); }
From source file:com.vectrace.MercurialEclipse.team.cache.MercurialStatusCache.java
License:Open Source License
@Override protected void configureFromPreferences(IPreferenceStore store) { enableSubrepos = store.getBoolean(MercurialPreferenceConstants.PREF_ENABLE_SUBREPO_SUPPORT); // TODO: group batches by repo root }
From source file:com.vectrace.MercurialEclipse.team.ResourceDecorator.java
License:Open Source License
/** * Init all the options we need from preferences to avoid doing this all the time *//* w w w . j a v a2 s . c o m*/ private void configureFromPreferences() { IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); folderLogic2MM = LABELDECORATOR_LOGIC_2MM.equals(store.getString(LABELDECORATOR_LOGIC)); colorise = store.getBoolean(PREF_DECORATE_WITH_COLORS); showChangesetInProjectLabel = store.getBoolean(RESOURCE_DECORATOR_SHOW_CHANGESET_IN_PROJECT_LABEL); showChangeset = store.getBoolean(RESOURCE_DECORATOR_SHOW_CHANGESET); showIncomingChangeset = store.getBoolean(RESOURCE_DECORATOR_SHOW_INCOMING_CHANGESET); showSummary = store.getBoolean(RESOURCE_DECORATOR_SHOW_SUMMARY); enableSubrepos = store.getBoolean(PREF_ENABLE_SUBREPO_SUPPORT); userSyntax = store.getString(PREF_DECORATE_PROJECT_LABEL_SYNTAX); showRepoLogicalName = store.getBoolean(PREF_SHOW_LOGICAL_NAME_OF_REPOSITORIES); }
From source file:com.vectrace.MercurialEclipse.ui.CommitFilesChooser.java
License:Open Source License
/** * Set the resources, and from those select resources, which are tracked by * Mercurial/* www . ja va2s.c o m*/ * * @param resources * non null */ public void setResources(List<IResource> resources) { CommitResource[] commitResources = createCommitResources(resources); getViewer().setInput(commitResources); IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore(); boolean preSelectAll = store .getBoolean(MercurialPreferenceConstants.PREF_PRESELECT_UNTRACKED_IN_COMMIT_DIALOG); if (preSelectAll) { getViewer().setCheckedElements(commitResources); } else { List<CommitResource> tracked = CommitResourceUtil.filterForTracked(commitResources); getViewer().setCheckedElements(tracked.toArray()); } if (selectable && (!showUntracked || preSelectAll)) { selectAllButton.setSelection(true); } // show clean file, if we are called on a single, not modified file // (revert to any version in the past) if (showClean && resources.size() == 1 && commitResources.length == 0) { IResource resource = resources.get(0); if (resource.getType() == IResource.FILE) { HgRoot hgRoot = MercurialTeamProvider.getHgRoot(resource); if (hgRoot == null) { return; } File path = new File(hgRoot.toRelative(ResourceUtils.getFileHandle(resource))); CommitResource cr = new CommitResource(MercurialStatusCache.BIT_CLEAN, resource, path); CommitResource[] input = new CommitResource[] { cr }; getViewer().setInput(input); getViewer().setCheckedElements(input); } } }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsole.java
License:Open Source License
private void initWrapSetting(IPreferenceStore store) { if (store.getBoolean(PREF_CONSOLE_WRAP)) { setConsoleWidth(store.getInt(PREF_CONSOLE_WIDTH)); } else {//from w w w. j a v a2 s . c om setConsoleWidth(-1); } }
From source file:com.vectrace.MercurialEclipse.views.console.HgConsole.java
License:Open Source License
private void initLimitOutput(IPreferenceStore store) { if (store.getBoolean(PREF_CONSOLE_LIMIT_OUTPUT)) { int highWaterMark = store.getInt(PREF_CONSOLE_HIGH_WATER_MARK); if (highWaterMark < 1000) { highWaterMark = 1000;//from www. ja v a 2 s. co m } setWaterMarks(0, highWaterMark); } else { setWaterMarks(0, 1000); } }