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: 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 #3
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 #4
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 #5
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 #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: 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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
Source File: CloudSdkPreferences.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
static void initializeDefaultPreferences(IPreferenceStore preferences) {
  if (!preferences.contains(CLOUD_SDK_MANAGEMENT)) {
    // If the CLOUD_SDK_MANAGEMENT preference has not been set, then determine the
    // appropriate setting. Note that CloudSdkPreferenceResolver only checks for
    // the Managed Cloud SDK when CLOUD_SDK_MANAGEMENT has been explicitly set
    // (i.e., this code has been run).
    configureManagementPreferences(preferences, isCloudSdkAvailable());
  }
  preferences.setDefault(CLOUD_SDK_MANAGEMENT, CloudSdkManagementOption.AUTOMATIC.name());
}
 
Example #14
Source File: MembersOrderPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean performOk() {

	//save preferences for both dialog lists
	IPreferenceStore store= getPreferenceStore();
	updateList(store, fSortOrderList, PREF_OUTLINE_SORT_OPTION);
	updateList(store, fVisibilityOrderList, PREF_VISIBILITY_SORT_OPTION);

	//update the button setting
	store.setValue(PREF_USE_VISIBILITY_SORT_OPTION, fUseVisibilitySortField.isSelected());
	JavaPlugin.flushInstanceScope();

	return true;
}
 
Example #15
Source File: PyDialogHelpers.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public static int openWarningWithIgnoreToggle(String title, String message, String key) {
    Shell shell = EditorUtils.getShell();
    IPreferenceStore store = PydevPlugin.getDefault().getPreferenceStore();
    String val = store.getString(key);
    if (val.trim().length() == 0) {
        val = MessageDialogWithToggle.PROMPT; //Initial value if not specified
    }

    if (!val.equals(MessageDialogWithToggle.ALWAYS)) {
        MessageDialogWithToggle.openWarning(shell, title, message, "Don't show this message again", false, store,
                key);
    }
    return MessageDialog.OK;
}
 
Example #16
Source File: JavaContext.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
	public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
		clear();

		if (!canEvaluate(template))
			throw new TemplateException(JavaTemplateMessages.Context_error_cannot_evaluate);

		TemplateTranslator translator= new TemplateTranslator() {
			@Override
			protected TemplateVariable createVariable(TemplateVariableType type, String name, int[] offsets) {
//				TemplateVariableResolver resolver= getContextType().getResolver(type.getName());
//				return resolver.createVariable();

				MultiVariable variable= new JavaVariable(type, name, offsets);
				fVariables.put(name, variable);
				return variable;
			}
		};
		TemplateBuffer buffer= translator.translate(template);

		getContextType().resolve(buffer, this);

		rewriteImports();

		IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore();
		boolean useCodeFormatter= prefs.getBoolean(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER);

		IJavaProject project= getJavaProject();
		JavaFormatter formatter= new JavaFormatter(TextUtilities.getDefaultLineDelimiter(getDocument()), getIndentation(), useCodeFormatter, project);
		formatter.format(buffer, this);

		clear();

		return buffer;
	}
 
Example #17
Source File: DialogUtils.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * openIgnoreMessageDialogInformation
 * 
 * @param shell
 * @param title
 * @param message
 * @param store
 * @param key
 * @return int
 */
public static int openIgnoreMessageDialogInformation(Shell shell, String title, String message,
		IPreferenceStore store, String key)
{
	if (!store.getString(key).equals(MessageDialogWithToggle.ALWAYS))
	{
		MessageDialogWithToggle d = MessageDialogWithToggle.openInformation(shell, title, message,
				Messages.DialogUtils_HideMessage, false, store, key);
		if (d.getReturnCode() == 3)
		{
			return MessageDialog.CANCEL;
		}
	}
	return MessageDialog.OK;
}
 
Example #18
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 #19
Source File: PreferenceWrapper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public PreferenceWrapper( IReportPreferenceFactory prefs, IProject project,
		IPreferenceStore prefsStore )
{
	preferenceType = SPECIAL_TYPE;
	this.prefs = prefs;
	this.prefsStore = prefsStore;
	this.project = project;
}
 
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: PyCoveragePreferences.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public static int getNameNumberOfColumns() {
    if (SharedCorePlugin.inTestMode()) {
        return DEFAULT_NUMBER_OF_COLUMNS_FOR_NAME;
    }
    PydevDebugPlugin plugin = PydevDebugPlugin.getDefault();
    IPreferenceStore preferenceStore = plugin.getPreferenceStore();
    int i = preferenceStore.getInt("PY_COVERAGE_NAME_COLUMNS_TO_USE");
    if (i <= 5) {
        return DEFAULT_NUMBER_OF_COLUMNS_FOR_NAME;
    }
    if (i > 256) {
        i = 256;
    }
    return i;
}
 
Example #22
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 #23
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 #24
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 #25
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 #26
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 #27
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 #28
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 #29
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 #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 );
}