org.eclipse.jface.preference.IPreferenceStore Java Examples

The following examples show how to use org.eclipse.jface.preference.IPreferenceStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ToggleMarkOccurrences.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ITextEditor activeEditor = EditorUtils.getActiveEditor();
    if (!(activeEditor instanceof PyEdit)) {
        return null;
    }
    PyEdit editor = (PyEdit) activeEditor;

    try {
        IPreferenceStore store = RefactoringPlugin.getDefault().getPreferenceStore();
        boolean prev = store.getBoolean(MarkOccurrencesPreferencesPage.USE_MARK_OCCURRENCES);
        store.setValue(MarkOccurrencesPreferencesPage.USE_MARK_OCCURRENCES, !prev);

        editor.getStatusLineManager().setMessage(
                "Toggled mark occurrences. Currently: " + (prev ? "Off" : "On"));

        MarkOccurrencesJob.scheduleRequest(new WeakReference<BaseEditor>(editor),
                editor.createTextSelectionUtils(), 0); //On the action, ask it to happen now.
    } catch (Exception e) {
        Log.log(e);
    }

    return null;
}
 
Example #2
Source File: TagStyleConfigurator.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private static ITokenScanner getRecipeScanner(final IDocument doc) {
		IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		/*final*/ InnerTagScanner scanner = new InnerTagScanner(store, IColorPreferenceConstant.TAG_FG_COLOR,
				IColorPreferenceConstant.TAG_BG_COLOR);
//		store.addPropertyChangeListener(new IPropertyChangeListener() {
//
//			public void propertyChange(PropertyChangeEvent event) {
//				String property = event.getProperty();
//				if (IColorPreferenceConstant.TAG_FG_COLOR.equals(property)
//						|| IColorPreferenceConstant.TAG_BG_COLOR.equals(property)) {
//					scanner.updateToken(IColorPreferenceConstant.TAG_FG_COLOR, IColorPreferenceConstant.TAG_BG_COLOR);
//
//					if (doc != null) { // 刷新
//						try {
//							doc.replace(doc.getLength(), 0, "");
//						} catch (BadLocationException e) {
//							e.printStackTrace();
//						}
//					}
//				}
//			}
//		});
		return scanner;
	}
 
Example #3
Source File: JavaTemplatePreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected SourceViewer createViewer(Composite parent) {
	IDocument document= new Document();
	JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
	tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store);
	SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false);
	viewer.configure(configuration);
	viewer.setEditable(false);
	viewer.setDocument(document);

	Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
	viewer.getTextWidget().setFont(font);
	new JavaSourcePreviewerUpdater(viewer, configuration, store);

	Control control= viewer.getControl();
	GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
	control.setLayoutData(data);

	return viewer;
}
 
Example #4
Source File: GenerateJSCodeConfigurationTab.java    From uml2solidity with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
	IPreferenceStore store = PreferenceConstants.getPreferenceStore(null);
	try {
		jsHeaderText.setText(configuration.getAttribute(JS_FILE_HEADER, store.getString(JS_FILE_HEADER)));
		jsDirectoryText.setText(configuration.getAttribute(GENERATE_JS_CONTROLLER_TARGET,
				store.getString(GENERATE_JS_CONTROLLER_TARGET)));
		testDirectoryText.setText(
				configuration.getAttribute(GENERATE_JS_TEST_TARGET, store.getString(GENERATE_JS_TEST_TARGET)));
		btnGenerateJsCode.setSelection(configuration.getAttribute(GENERATE_JS_CONTROLLER, store.getBoolean(GENERATE_JS_CONTROLLER)));
		btnGenerateJsTestcode.setSelection(configuration.getAttribute(GENERATE_JS_TEST, store.getBoolean(GENERATE_JS_TEST)));
		btnGenerateWeb3.setSelection(configuration.getAttribute(GENERATE_WEB3,store.getBoolean(GENERATE_WEB3)));

		IResource member = findResource(configuration, jsDirectoryText.getText());
		if (member != null)
			jsDirectoryText.setText(member.getFullPath().toString());
		member = findResource(configuration, testDirectoryText.getText());
		if (member != null)
			testDirectoryText.setText(member.getFullPath().toString());

	} catch (CoreException e) {
		Activator.logError("Error initalizing from LauncheConfig", e);
	}

}
 
Example #5
Source File: RunContainerPreferenceInitializer.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = ESBRunContainerPlugin.getDefault().getPreferenceStore();
    store.setDefault(P_ESB_RUNTIME_LOCATION, P_DEFAULT_ESB_RUNTIME_LOCATION);
    store.setDefault(P_ESB_RUNTIME_HOST, P_DEFAULT_ESB_RUNTIME_HOST);
    store.setDefault(P_ESB_RUNTIME_PORT, P_DEFAULT_ESB_RUNTIME_PORT);
    store.setDefault(P_ESB_RUNTIME_USERNAME, P_DEFAULT_ESB_RUNTIME_USERNAME);
    store.setDefault(P_ESB_RUNTIME_PASSWORD, P_DEFAULT_ESB_RUNTIME_PASSWORD);
    // store.setDefault(P_ESB_RUNTIME_MAVEN_SCRIPT, P_DEFAULT_ESB_RUNTIME_MAVEN_SCRIPT);
    store.setDefault(P_ESB_RUNTIME_CLEAN_CACHE, P_DEFAULT_ESB_RUNTIME_CLEAN_CACHE);
    store.setDefault(P_ESB_RUNTIME_JMX, P_DEFAULT_ESB_RUNTIME_JMX);
    store.setDefault(P_ESB_RUNTIME_JMX_PORT, P_DEFAULT_ESB_RUNTIME_JMX_PORT);
    store.setDefault(P_ESB_RUNTIME_SYS_LOG, P_DEFAULT_ESB_RUNTIME_SYS_LOG);
    store.setDefault(P_ESB_RUNTIME_INSTANCE, P_DEFAULT_ESB_RUNTIME_INSTANCE);
    store.setDefault(P_ESB_IN_OSGI, P_DEFAULT_ESB_IN_OSGI);
}
 
Example #6
Source File: AppearanceAwareLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void initMasks() {
	IPreferenceStore store= PreferenceConstants.getPreferenceStore();
	fTextFlagMask= -1;
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE)) {
		fTextFlagMask ^= JavaElementLabels.M_APP_RETURNTYPE;
	}
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_METHOD_TYPEPARAMETERS)) {
		fTextFlagMask ^= JavaElementLabels.M_APP_TYPE_PARAMETERS;
	}
	if (!(store.getBoolean(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES)
			|| store.getBoolean(PreferenceConstants.APPEARANCE_ABBREVIATE_PACKAGE_NAMES))) {
		fTextFlagMask ^= JavaElementLabels.P_COMPRESSED;
	}
	if (!store.getBoolean(PreferenceConstants.APPEARANCE_CATEGORY)) {
		fTextFlagMask ^= JavaElementLabels.ALL_CATEGORY;
	}

	fImageFlagMask= -1;
}
 
Example #7
Source File: ResourceFileFolderSelectionAction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void run( )
{
	ResourceFilterDialog dialog = new ResourceFilterDialog( );
	ArrayList filters = new ArrayList( );
	filters.addAll( ReportPlugin.getFilterMap( this.dialog.isShowEmptyFolderFilter( ) )
			.values( ) );
	dialog.setInput( filters );
	if ( dialog.open( ) == Window.OK )
	{
		IPreferenceStore store = ReportPlugin.getDefault( )
				.getPreferenceStore( );
		for ( int i = 0; i < filters.size( ); i++ )
		{
			ResourceFilter filter = (ResourceFilter) filters.get( i );
			store.setValue( filter.getType( ), filter.isEnabled( ) );
		}
		this.dialog.refreshRoot( );
	}
}
 
Example #8
Source File: SemanticHighlightings.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * In 3.0, methods were highlighted by a rule-based word matcher that
 * matched any identifier that was followed by possibly white space and a
 * left parenthesis.
 * <p>
 * With generics, this does not work any longer for constructors of generic
 * types, and the highlighting has been moved to be a semantic highlighting.
 * Because different preference key naming schemes are used, we have to
 * migrate the old settings to the new ones, which is done here. Nothing
 * needs to be done if the old settings were set to the default values.
 * </p>
 *
 * @param store the preference store to migrate
 * @since 3.1
 */
private static void convertMethodHighlightingPreferences(IPreferenceStore store) {
	String colorkey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_COLOR_SUFFIX;
	String boldkey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX;
	String italickey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX;
	String enabledkey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + METHOD + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX;

	@SuppressWarnings("deprecation") String oldColorkey= PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR;
	@SuppressWarnings("deprecation") String oldBoldkey= PreferenceConstants.EDITOR_JAVA_METHOD_NAME_BOLD;
	@SuppressWarnings("deprecation") String oldItalickey= PreferenceConstants.EDITOR_JAVA_METHOD_NAME_ITALIC;

	if (conditionalReset(store, oldColorkey, colorkey)
			|| conditionalReset(store, oldBoldkey, boldkey)
			|| conditionalReset(store, oldItalickey, italickey)) {
		store.setValue(enabledkey, true);
	}

}
 
Example #9
Source File: FindBugsPreferenceInitializer.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static void restoreDefaults(IPreferenceStore store) {
    store.setToDefault(EXPORT_SORT_ORDER);
    store.setToDefault(DONT_REMIND_ABOUT_FULL_BUILD);
    store.setToDefault(DISABLED_CATEGORIES);
    store.setToDefault(RUN_ANALYSIS_AUTOMATICALLY);
    store.setToDefault(RUN_ANALYSIS_ON_FULL_BUILD);
    store.setToDefault(ASK_ABOUT_PERSPECTIVE_SWITCH);
    store.setToDefault(SWITCH_PERSPECTIVE_AFTER_ANALYSIS);
    store.setToDefault(RANK_OFCONCERN_MARKER_SEVERITY);
    store.setToDefault(RANK_TROUBLING_MARKER_SEVERITY);
    store.setToDefault(RANK_SCARY_MARKER_SEVERITY);
    store.setToDefault(RANK_SCARIEST_MARKER_SEVERITY);

    store.setToDefault(KEY_CACHE_CLASS_DATA);
    store.setToDefault(KEY_RUN_ANALYSIS_AS_EXTRA_JOB);
}
 
Example #10
Source File: PDGObjectSliceUnion.java    From JDeodorant with MIT License 6 votes vote down vote up
private boolean complyWithUserThresholds() {
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	int minimumSliceSize = store.getInt(PreferenceConstants.P_MINIMUM_SLICE_SIZE);
	int maximumSliceSize = store.getInt(PreferenceConstants.P_MAXIMUM_SLICE_SIZE);
	int maximumDuplication = store.getInt(PreferenceConstants.P_MAXIMUM_DUPLICATION);
	double maximumRatioOfDuplicatedToExtracted = store.getDouble(
			PreferenceConstants.P_MAXIMUM_RATIO_OF_DUPLICATED_TO_EXTRACTED);
	
	int sliceSize = sliceNodes.size();
	int duplicatedSize = sliceSize - removableNodes.size();
	double ratioOfDuplicatedToExtracted = (double)duplicatedSize/(double)sliceSize;
	
	if(sliceSize < minimumSliceSize)
		return false;
	if(sliceSize > (methodSize - maximumSliceSize))
		return false;
	if(duplicatedSize > maximumDuplication)
		return false;
	if(ratioOfDuplicatedToExtracted > maximumRatioOfDuplicatedToExtracted)
		return false;
	return true;
}
 
Example #11
Source File: PreferenceUtil.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 获取项目属性的文本字段
 * @return ;
 */
public static ArrayList<String> getProjectFieldList() {
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	ArrayList<String> lstField = new ArrayList<String>();
	int fieldCount = store
			.getInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.fieldCount");
	if (fieldCount > 0) {
		for (int i = 0; i < fieldCount; i++) {
			lstField.add(store
					.getString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field" + i));
		}
	}
	// 对中文按拼音排序
	Collator collatorChinese = Collator.getInstance(java.util.Locale.CHINA);
	Collections.sort(lstField, collatorChinese);
	return lstField;
}
 
Example #12
Source File: JavaTemplatesPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected SourceViewer createPatternViewer(Composite parent) {
	IDocument document= new Document();
	JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
	tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	JavaSourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store);
	SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false);
	viewer.configure(configuration);
	viewer.setEditable(false);
	viewer.setDocument(document);

	Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
	viewer.getTextWidget().setFont(font);
	new JavaSourcePreviewerUpdater(viewer, configuration, store);

	Control control= viewer.getControl();
	GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
	control.setLayoutData(data);

	viewer.setEditable(false);
	return viewer;
}
 
Example #13
Source File: PreferenceStoreProvider.java    From SparkBuilderGenerator with MIT License 5 votes vote down vote up
public PreferenceStoreWrapper providePreferenceStore() {
    IPreferenceStore[] preferenceStores = new IPreferenceStore[2];
    preferenceStores[0] = Activator.getDefault().getPreferenceStore();

    ScopedPreferenceStore jdtCorePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.jdt.core");
    if (currentJavaProject.isPresent()) { // if we are in a project add to search scope
        jdtCorePreferenceStore.setSearchContexts(new IScopeContext[] { new ProjectScope(currentJavaProject.get().getProject()), InstanceScope.INSTANCE });
    }
    preferenceStores[1] = jdtCorePreferenceStore;

    return new PreferenceStoreWrapper(new ChainedPreferenceStore(preferenceStores));
}
 
Example #14
Source File: DiffMergePreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initializes states of the controls from the preference store.
 */
private void initializeValues() {
    IPreferenceStore store = getPreferenceStore();

    String mergeProviderPreference = store.getString(ISVNUIConstants.PREF_MERGE_PROVIDER);
    if (mergeProviderPreference == null) mergeProviders[0].getName();
    for (int i = 0; i < mergeProviders.length; i++) {
    	if (mergeProviders[i].getName().equals(mergeProviderPreference)) {
    		mergeImplementationCombo.setText(mergeProviders[i].getName());
    		break;
    	}
    }
    if (mergeImplementationCombo.getText().length() == 0) mergeImplementationCombo.setText(mergeProviders[0].getName());
    
    suggestMergeSourcesButton.setSelection(store.getBoolean(ISVNUIConstants.PREF_SUGGEST_MERGE_SOURCES));
    suggestMergeSourcesButton.setVisible(mergeImplementationCombo.getText().equals("CollabNet Desktop")); //$NON-NLS-1$
    
    mergeProgramLocationText.setText(store
            .getString(ISVNUIConstants.PREF_MERGE_PROGRAM_LOCATION));
    mergeProgramParametersText.setText(store
            .getString(ISVNUIConstants.PREF_MERGE_PROGRAM_PARAMETERS));

    if (store.getBoolean(ISVNUIConstants.PREF_MERGE_USE_EXTERNAL)) {
        builtInMergeRadioButton.setSelection(false);
        externalMergeRadioButton.setSelection(true);
    } else {
        builtInMergeRadioButton.setSelection(true);
        externalMergeRadioButton.setSelection(false);
    }
    updateEnablements();
}
 
Example #15
Source File: BingTransPreferenceInitializer.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/** (non-Javadoc)
 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
 */
@Override
public void initializeDefaultPreferences() {
	IPreferenceStore ps = Activator.getDefault().getPreferenceStore();
	ps.setDefault(IPreferenceConstant.STATE, false);
	ps.setDefault(IPreferenceConstant.ID, "");
	ps.setDefault(IPreferenceConstant.KEY, "");
	
	ps.setDefault(IPreferenceConstant.NO_REPEATE_ACCESS, true);
	ps.setDefault(IPreferenceConstant.ALWAYS_ACCESS, false);
	ps.setDefault(IPreferenceConstant.MANUAL_ACCESS, false);
	
	ps.setDefault(IPreferenceConstant.PRETRANS_STATE, false);
}
 
Example #16
Source File: UserAgentManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Process the preference key value associated with UserAgentManager. This method is automatically called when the
 * singleton instance is created. If the preference key value is somehow manipulated outside of UserAgentManager
 * (and it shouldn't be), then this method will need to be invoked to update the in-memory cache of
 * nature/user-agent info.
 */
void loadPreference()
{
	// Grab preference value. We use a ChainedPreferenceStore to be able to migrate the preference location from the
	// UIEplPlugin to the CommonEditorPlugin (the new location that we will use to save the
	// IPreferenceConstants.USER_AGENT_PREFERENCE)
	ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] {
			CommonEditorPlugin.getDefault().getPreferenceStore(), UIEplPlugin.getDefault().getPreferenceStore() });
	String preferenceValue = chainedStore.getString(IPreferenceConstants.USER_AGENT_PREFERENCE);

	Map<String, String[]> result;
	if (!StringUtil.isEmpty(preferenceValue))
	{
		result = extractUserAgents(preferenceValue);
	}
	else
	{
		result = new HashMap<String, String[]>();
		// set defaults
		for (String natureID : ResourceUtil.getAptanaNaturesMap().values())
		{
			result.put(natureID, getDefaultUserAgentIDs(natureID));
		}
	}

	// cache result
	ACTIVE_USER_AGENTS_BY_NATURE_ID = result;
}
 
Example #17
Source File: PyVariablesPreferences.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private static void setDefaultHelper(String key, boolean value) {
    if (SharedCorePlugin.inTestMode()) {
        // ignore set
    } else {
        PydevDebugPlugin plugin = PydevDebugPlugin.getDefault();
        IPreferenceStore preferenceStore = plugin.getPreferenceStore();
        preferenceStore.setDefault(key, value);
    }
}
 
Example #18
Source File: PreferenceInitializer.java    From CppStyle with MIT License 5 votes vote down vote up
public void initializeDefaultPreferences() {
	IPreferenceStore store = CppStyle.getDefault().getPreferenceStore();
	store.setDefault(CppStyleConstants.CLANG_FORMAT_PATH,
			findBinaryPath("clang-format"));
	store.setDefault(CppStyleConstants.CPPLINT_PATH,
			findBinaryPath("cpplint.py"));
	store.setDefault(CppStyleConstants.ENABLE_CPPLINT_ON_SAVE, false);
	store.setDefault(CppStyleConstants.ENABLE_CLANGFORMAT_ON_SAVE, false);
}
 
Example #19
Source File: JavaSourceViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the preference store on this viewer.
 *
 * @param store the preference store
 *
 * @since 3.0
 */
public void setPreferenceStore(IPreferenceStore store) {
	if (fIsConfigured && fPreferenceStore != null)
		fPreferenceStore.removePropertyChangeListener(this);

	fPreferenceStore= store;

	if (fIsConfigured && fPreferenceStore != null) {
		fPreferenceStore.addPropertyChangeListener(this);
		initializeViewerColors();
	}
}
 
Example #20
Source File: PreferenceStoreAccessImpl.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
	lazyInitialize();
	// may be null on shutdown
	Activator activator = Activator.getDefault();
	if (activator != null)
		return new ChainedPreferenceStore(new IPreferenceStore[] { 
				getWritablePreferenceStore(context),
				activator.getPreferenceStore(),
				EditorsUI.getPreferenceStore()});
	return new ChainedPreferenceStore(new IPreferenceStore[] { 
			getWritablePreferenceStore(context),
			EditorsUI.getPreferenceStore()});
}
 
Example #21
Source File: TypeScriptSourceViewerConfiguration.java    From typescript.java with MIT License 5 votes vote down vote up
public TypeScriptSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore,
		ITextEditor editor, String partitioning) {
	super(colorManager, preferenceStore, editor, partitioning);
	fCodeScanner = new TypeScriptCodeScanner(colorManager, preferenceStore);
	jsxScanner = new JSXScanner(colorManager, preferenceStore);
	this.preferenceStore = preferenceStore;

}
 
Example #22
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createIntermediateThrowMessageEvent_3014(EObject domainElement, View containerView, int index,
		boolean persisted, PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(IntermediateThrowMessageEvent2EditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5030 = createLabel(node,
			ProcessVisualIDRegistry.getType(IntermediateThrowMessageEventLabel2EditPart.VISUAL_ID));
	label5030.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
	Location location5030 = (Location) label5030.getLayoutConstraint();
	location5030.setX(0);
	location5030.setY(5);
	return node;
}
 
Example #23
Source File: PreferenceInitializer.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static void addDBSetting(final DBSetting dbSetting) {
    final IPreferenceStore store = ERDiagramActivator.getDefault().getPreferenceStore();

    int num = store.getInt(PreferenceInitializer.DB_SETTING_LIST_NUM);
    num++;
    store.setValue(PreferenceInitializer.DB_SETTING_LIST_NUM, num);

    saveSetting(num, dbSetting);
}
 
Example #24
Source File: StartRuntimeProgress.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void run(IProgressMonitor parentMonitor) throws InvocationTargetException, InterruptedException {
    SubMonitor subMonitor = SubMonitor.convert(parentMonitor, 100);
    subMonitor.setTaskName(RunContainerMessages.getString("StartRuntimeAction.Starting")); //$NON-NLS-1$
    if (!checkRunning()) {
        try {
            IPreferenceStore store = ESBRunContainerPlugin.getDefault().getPreferenceStore();
            Process proc = RuntimeServerController.getInstance().startLocalRuntimeServer(
                    store.getString(RunContainerPreferenceInitializer.P_ESB_RUNTIME_LOCATION));
            int i = 0;
            String dot = "."; //$NON-NLS-1$
            while (JMXUtil.createJMXconnection() == null && ++i < 101 && !subMonitor.isCanceled() && proc.isAlive()) {
                subMonitor.subTask(RunContainerMessages.getString("StartRuntimeAction.Try") + dot); //$NON-NLS-1$
                dot += "."; //$NON-NLS-1$
                subMonitor.worked(1);
                Thread.sleep(3000);
            }
            if (!proc.isAlive()) {
                RuntimeServerController.getInstance().stopLocalRuntimeServer();
                throw new InterruptedException(RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog8",
                        proc.exitValue()));
            }
            if (JMXUtil.createJMXconnection() == null) {
                throw new InterruptedException(RunContainerMessages.getString("RunContainerPreferencePage.InitailzeDialog5"));
            }
        } catch (Exception e) {
            ExceptionHandler.process(e);
            throw new InvocationTargetException(e, e.getMessage());
        }
    }
    loadConsole();
}
 
Example #25
Source File: SdkManager.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private void saveSdkRegistry(XMLMemento memento, SdkRegistry sdkRegistry) {
       String actSdk = (sdkRegistry.getDefaultSdk() != null) ? sdkRegistry.getDefaultSdk().getName() : ""; //$NON-NLS-1$
       IPreferenceStore store = XdsCorePlugin.getDefault().getPreferenceStore();
       store.setValue(KEY_ACTIVE_SDK_NAME, actSdk);
       WorkspacePreferencesManager.getInstance().flush();

	for (Sdk sdk : sdkRegistry.getRegisteredSDKs()) {
		IMemento mementoSdk = memento.createChild(TAG_SDK);
		for (Sdk.Property property: Sdk.Property.values()) {
			mementoSdk.putString(property.xmlKey, sdk.getPropertyValue(property));
			for (Sdk.Tag tag : property.possibleTags) {
			    String val = sdk.getTag(property, tag);
			    if (val != null) {
			        String key = property.xmlKey + "_" + tag.xmlTagName; //$NON-NLS-1$
	                mementoSdk.putString(key, val);
			    }
			}
		}
		 Map<String, String> environmentVariables = sdk.getEnvironmentVariablesRaw();
		if (!environmentVariables.isEmpty()) {
			for (Map.Entry<String, String> entry : environmentVariables.entrySet()) {
				IMemento mementoEnvVar = mementoSdk.createChild(TAG_ENVIRONMENT_VARIABLE);
				mementoEnvVar.putString(TAG_ENVIRONMENT_VARIABLE_NAME,  entry.getKey());
				mementoEnvVar.putString(TAG_ENVIRONMENT_VARIABLE_VALUE, entry.getValue());
			}
		}
		saveTools(mementoSdk, sdk);
	}
}
 
Example #26
Source File: PreferenceInitializer.java    From eclipse-explorer with Eclipse Public License 1.0 5 votes vote down vote up
public void initializeDefaultPreferences() {
	IPreferenceStore store = ExplorerPlugin.getDefault().getPreferenceStore();
	String cmd = "explorer";
	int os = ExplorerPlugin.getOS();
	if (os == ExplorerPlugin.OS_LINUX) {
		cmd = "nautilus";
	}
	else if (os == ExplorerPlugin.OS_MAC) {
	    cmd = "open -R";
	}
	store.setDefault(PreferenceConstants.EXPLORER_CMD, cmd);
	store.setDefault(PreferenceConstants.EXPLORER_TIP, true);
}
 
Example #27
Source File: AutomaticUpdateScheduler.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * The constructor.
 */
public AutomaticUpdateScheduler() {
	checker = new UpdateChecker();
	IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore();
	pref.addPropertyChangeListener(new IPropertyChangeListener() {
		@Override
		public void propertyChange(PropertyChangeEvent event) {
			rescheduleUpdate();
		}
	});
}
 
Example #28
Source File: PerspectivesPreferencePage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Constructor
 */
public PerspectivesPreferencePage() {
    super(FieldEditorPreferencePage.GRID);

    // Set the preference store for the preference page.
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    setPreferenceStore(store);
}
 
Example #29
Source File: ComponentDetailsFieldEditor.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @return the preference stores associated with the contained field editors (they store their values in separate
 *         preference stores)
 */
public List<IPreferenceStore> getPreferenceStores() {
	if (detailsPart != null) {
		return detailsPart.getPreferenceStores();
	}
	return new ArrayList<>();
}
 
Example #30
Source File: DebugUIPreferencesTest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testGetPreferenceStore() {
  DebugUIPreferences debugUIPreferences = new DebugUIPreferences( preferenceStore );

  IPreferenceStore returnedPreferenceStore = debugUIPreferences.getPreferenceStore();

  assertThat( returnedPreferenceStore ).isEqualTo( preferenceStore );
}