类org.eclipse.ui.editors.text.EditorsUI源码实例Demo

下面列出了怎么用org.eclipse.ui.editors.text.EditorsUI的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: solidity-ide   文件: CustomCSSHelpHoverProvider.java
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI
			.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont";
		BrowserInformationControl iControl = new BrowserInformationControl(
				parent, font, false) {
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent,
				tooltipAffordanceString);
	}
}
 
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME: PreferenceConstants.APPEARANCE_JAVADOC_FONT;
		IXtextBrowserInformationControl iControl = new XtextBrowserInformationControl(parent, font,
				tooltipAffordanceString) {
			/*
			 * @see org.eclipse.jface.text.IInformationControlExtension5#getInformationPresenterControlCreator()
			 */
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
源代码3 项目: birt   文件: DecoratedScriptEditor.java
/**
 * Constructs a decorated script editor with the specified parent and the
 * specified script.
 * 
 * @param parent
 *            the parent editor.
 * @param script
 *            the script to edit
 */
public DecoratedScriptEditor( IEditorPart parent, String script )
{
	super( );
	this.parent = parent;
	this.sourceViewerConfiguration = new ScriptSourceViewerConfiguration( context );
	setSourceViewerConfiguration( this.sourceViewerConfiguration );
	setDocumentProvider( new ScriptDocumentProvider( parent ) );
	setScript( script );

	IPreferences preferences = PreferenceFactory.getInstance( )
			.getPreferences( ReportPlugin.getDefault( ) );
	if ( preferences instanceof PreferenceWrapper )
	{
		IPreferenceStore store = ( (PreferenceWrapper) preferences ).getPrefsStore( );
		if ( store != null )
		{
			IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
			setPreferenceStore( new ChainedPreferenceStore(new IPreferenceStore[]{store, baseEditorPrefs}) );
		}
	}
}
 
源代码4 项目: xtext-eclipse   文件: XbaseHoverProvider.java
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont";
		IXtextBrowserInformationControl iControl = new XbaseInformationControl(parent, font,
				tooltipAffordanceString, xbaseHoverConfiguration) {
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
源代码5 项目: xds-ide   文件: SpellCheckEngine.java
/**
 * Creates a new spell check manager.
 */
private SpellCheckEngine() {

	try {

		Locale locale= null;
		final Enumeration<URL> locations= getDictionaryLocations();

		while (locations != null && locations.hasMoreElements()) {
			URL location= locations.nextElement();

			for (final Iterator<Locale> iterator= getLocalesWithInstalledDictionaries(location).iterator(); iterator.hasNext();) {

				locale= iterator.next();
				fLocaleDictionaries.put(locale, new LocaleSensitiveSpellDictionary(locale, location));
			}
		}

	} catch (IOException exception) {
		// Do nothing
	}
	
	PreferenceKeys.PKEY_SPELLING_LOCALE.addChangeListener(this);
	EditorsUI.getPreferenceStore().addPropertyChangeListener(this);
}
 
源代码6 项目: xds-ide   文件: SpellCheckEngine.java
public synchronized final void shutdown() {

	    PreferenceKey.removeChangeListener(PreferenceKeys.PKEY_SPELLING_LOCALE.getQualifier(), this);
		EditorsUI.getPreferenceStore().removePropertyChangeListener(this);

		ISpellDictionary dictionary= null;
		for (final Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) {
			dictionary= iterator.next();
			dictionary.unload();
		}
		fGlobalDictionaries= null;

		for (final Iterator<ISpellDictionary> iterator= fLocaleDictionaries.values().iterator(); iterator.hasNext();) {
			dictionary= iterator.next();
			dictionary.unload();
		}
		fLocaleDictionaries= null;

		fUserDictionary= null;
		fChecker= null;
	}
 
源代码7 项目: goclipse   文件: AbstractLangEditor.java
protected IPreferenceStore createCombinedPreferenceStore(IEditorInput input) {
	List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>(4);
	
	IProject project = EditorUtils.getAssociatedProject(input);
	if (project != null) {
		stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), LangUIPlugin.PLUGIN_ID));
	}
	
	stores.add(LangUIPlugin.getInstance().getPreferenceStore());
	stores.add(LangUIPlugin.getInstance().getCorePreferenceStore());
	
	alterCombinedPreferenceStores_beforeEditorsUI(stores);
	stores.add(EditorsUI.getPreferenceStore());
	
	return new ChainedPreferenceStore(ArrayUtil.createFrom(stores, IPreferenceStore.class));
}
 
源代码8 项目: statecharts   文件: HelpHoverProvider.java
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		String font = "org.eclipse.jdt.ui.javadocfont";

		boolean areHoverDocsScrollable = true;

		// resizable flag of BrowserInformationControl causes the scrollbar to be always
		// enabled.
		BrowserInformationControl iControl = new BrowserInformationControl(parent, font,
				areHoverDocsScrollable) {
			@Override
			public IInformationControlCreator getInformationPresenterControlCreator() {
				return fInformationPresenterControlCreator;
			}
		};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
源代码9 项目: gama   文件: GamlHoverProvider.java
@Override
public IInformationControl doCreateInformationControl(final Shell parent) {

	final String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
	if (BrowserInformationControl.isAvailable(parent)) {
		final String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME:
																// PreferenceConstants.APPEARANCE_JAVADOC_FONT;
		final IXtextBrowserInformationControl iControl =
				new GamlInformationControl(parent, font, tooltipAffordanceString) {

				};
		addLinkListener(iControl);
		return iControl;
	} else {
		return new DefaultInformationControl(parent, tooltipAffordanceString);
	}
}
 
public IInformationControl doCreateInformationControl(Shell parent)
{
	if (CustomBrowserInformationControl.isAvailable(parent))
	{
		CustomBrowserInformationControl iControl = new CustomBrowserInformationControl(parent, null,
				EditorsUI.getTooltipAffordanceString())
		{
			public IInformationControlCreator getInformationPresenterControlCreator()
			{
				return informationPresenterControlCreator;
			}
		};
		iControl.setBackgroundColor(getBackgroundColor());
		iControl.setForegroundColor(getForegroundColor());
		return iControl;
	}
	else
	{
		// return new ThemedInformationControl(parent, null, EditorsUI.getTooltipAffordanceString());
		return new DefaultInformationControl(parent, true);
	}
}
 
源代码11 项目: APICloud-Studio   文件: SVNConflictResolver.java
private String getEditorId(IFileStore file) {
	IWorkbench workbench = PlatformUI.getWorkbench();
	IEditorRegistry editorRegistry= workbench.getEditorRegistry();
	IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

	// check the OS for in-place editor (OLE on Win32)
	if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
	
	// check the OS for external editor
	if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
	
	if (descriptor != null)
		return descriptor.getId();
	
	return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
 
@Override
protected void initializeEditor() {
	setDocumentProvider(JavaPlugin.getDefault().getPropertiesFileDocumentProvider());
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	setPreferenceStore(store);
	JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
	setSourceViewerConfiguration(new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, this, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING));
	setEditorContextMenuId("#TextEditorContext"); //$NON-NLS-1$
	setRulerContextMenuId("#TextRulerContext"); //$NON-NLS-1$
	setHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR);
	configureInsertMode(SMART_INSERT, false);
	setInsertMode(INSERT);

	// Need to listen on Editors UI preference store because JDT disables this functionality in its preferences.
	fPropertyChangeListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS.equals(event.getProperty()))
				handlePreferenceStoreChanged(event);
		}
	};
	EditorsUI.getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
}
 
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		return null;

	IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
		@Override
		protected IContentType getContentType() {
			return PROPERTIES_CONTENT_TYPE;
		}
	};

	MonoReconciler reconciler= new MonoReconciler(strategy, false);
	reconciler.setDelay(500);
	return reconciler;
}
 
源代码14 项目: Pydev   文件: PyOpenResourceAction.java
@Override
protected void openFiles(PythonpathZipChildTreeNode[] pythonPathFilesSelected) {
    for (PythonpathZipChildTreeNode n : pythonPathFilesSelected) {
        try {
            if (PythonPathHelper.isValidSourceFile(n.zipPath)) {
                new PyOpenAction().run(new ItemPointer(n.zipStructure.file, new Location(), new Location(), null,
                        n.zipPath));
            } else {
                IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry();
                IEditorDescriptor defaultEditor = editorReg.getDefaultEditor(n.zipPath);
                PydevZipFileStorage storage = new PydevZipFileStorage(n.zipStructure.file, n.zipPath);
                PydevZipFileEditorInput input = new PydevZipFileEditorInput(storage);

                if (defaultEditor != null) {
                    IDE.openEditor(page, input, defaultEditor.getId());
                } else {
                    IDE.openEditor(page, input, EditorsUI.DEFAULT_TEXT_EDITOR_ID);
                }
            }
        } catch (PartInitException e) {
            Log.log(e);
        }
    }
}
 
public final void propertyChange(final PropertyChangeEvent event) {
	if (event.getProperty().equals(PreferenceConstants.SPELLING_LOCALE)) {
		resetSpellChecker();
		return;
	}

	if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY)) {
		resetUserDictionary();
		return;
	}

	if (event.getProperty().equals(PreferenceConstants.SPELLING_USER_DICTIONARY_ENCODING)) {
		resetUserDictionary();
		return;
	}

	if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
		if (this == fgEngine)
			SpellCheckEngine.shutdownInstance();
		else
			shutdown();
	}
}
 
public synchronized final void shutdown() {

		JavaPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
		EditorsUI.getPreferenceStore().removePropertyChangeListener(this);

		ISpellDictionary dictionary= null;
		for (final Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) {
			dictionary= iterator.next();
			dictionary.unload();
		}
		fGlobalDictionaries= null;

		for (final Iterator<ISpellDictionary> iterator= fLocaleDictionaries.values().iterator(); iterator.hasNext();) {
			dictionary= iterator.next();
			dictionary.unload();
		}
		fLocaleDictionaries= null;

		fUserDictionary= null;
		fChecker= null;
	}
 
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
	if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
		return null;

	IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
		@Override
		protected IContentType getContentType() {
			return EditorConfigTextTools.EDITORCONFIG_CONTENT_TYPE;
		}
	};

	MonoReconciler reconciler = new MonoReconciler(strategy, false);
	reconciler.setDelay(500);
	return reconciler;
}
 
源代码18 项目: saros   文件: SarosAnnotation.java
/**
 * Loads the default colors from the plugin.xml and overwrites possible errors in the EditorsUI
 * preference store.
 */
public static void resetColors() {

  log.debug("resetting annotation colors");

  final IPreferenceStore preferenceStore = EditorsUI.getPreferenceStore();

  final AnnotationPreferenceLookup lookup = EditorsUI.getAnnotationPreferenceLookup();

  final String[] annotationTypesToReset = {
    SelectionAnnotation.TYPE, ViewportAnnotation.TYPE, ContributionAnnotation.TYPE
  };

  for (int i = 0; i <= SIZE; ++i) {

    for (String annotationType : annotationTypesToReset) {

      final String annotationTypeToLookup = getNumberedType(annotationType, i);

      final AnnotationPreference preference =
          lookup.getAnnotationPreference(annotationTypeToLookup);

      if (preference == null) {
        log.warn("could not reset color for annotation type: " + annotationTypeToLookup);
        continue;
      }

      preferenceStore.setToDefault(preference.getColorPreferenceKey());

      if (log.isTraceEnabled()) {
        log.trace(
            "reset "
                + annotationTypeToLookup
                + " to: "
                + preferenceStore.getString(preference.getColorPreferenceKey()));
      }
    }
  }
}
 
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
	return new AnnotationInformationControl(parent, EditorsUI.getTooltipAffordanceString()) {

		@Override
		public IInformationControlCreator getInformationPresenterControlCreator() {
			return fPresenterControlCreator;
		}
	};
}
 
源代码20 项目: saros   文件: SarosAnnotation.java
/**
 * Returns the color for the given annotation type and user color id.
 *
 *<p>E.g: <code>getColor("saros.annotations.viewport", 2)
 * <p><b>Important notice:</b> Every returned color instance allocates OS resources that need to
 * be disposed with {@link Color#dispose()}!
 *
 * @see Annotation#getType()
 * @param type annotation type as defined in the plugin.xml
 * @param colorId the color id
 * @return the corresponding color or a default one if no color is stored
 */
public static Color getColor(final String type, final int colorId) {

  final String typeToLookup = getNumberedType(type, colorId);

  final AnnotationPreference ap =
      EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(typeToLookup);

  if (ap == null)
    throw new IllegalArgumentException(
        "could not read color value of annotation '"
            + typeToLookup
            + "' because it does not exists");

  RGB rgb =
      PreferenceConverter.getColor(EditorsUI.getPreferenceStore(), ap.getColorPreferenceKey());

  if (rgb == PreferenceConverter.COLOR_DEFAULT_DEFAULT) { // NOPMD
    rgb = ap.getColorPreferenceValue();
  }

  if (rgb == null)
    throw new IllegalArgumentException(
        "annotation '" + typeToLookup + "' does not have a default color");

  return new Color(Display.getDefault(), rgb);
}
 
源代码21 项目: xtext-eclipse   文件: AbstractHover.java
@Override
public IInformationControlCreator getHoverControlCreator() {
	return new IInformationControlCreator() {
		@Override
		public IInformationControl createInformationControl(Shell parent) {
			return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
		}
	};
}
 
@Override
public boolean canReuse(IInformationControl control) {
	if (!super.canReuse(control))
		return false;

	if (control instanceof IInformationControlExtension4) {
		String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
		((IInformationControlExtension4) control).setStatusText(tooltipAffordanceString);
	}

	return true;
}
 
源代码23 项目: xtext-eclipse   文件: PreferenceStoreAccessImpl.java
@Override
public IPreferenceStore getPreferenceStore() {
	lazyInitialize();
	Activator activator = Activator.getDefault();
	if (activator != null)
		return new ChainedPreferenceStore(new IPreferenceStore[] {
				getWritablePreferenceStore(),
				activator.getPreferenceStore(), 
				EditorsUI.getPreferenceStore() });
	return new ChainedPreferenceStore(new IPreferenceStore[] {
			getWritablePreferenceStore(),
			EditorsUI.getPreferenceStore() });
}
 
源代码24 项目: xtext-eclipse   文件: PreferenceStoreAccessImpl.java
@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()});
}
 
源代码25 项目: texlipse   文件: TexSourceViewerConfiguration.java
/**
 * Creates a new source viewer configuration.
 * 
 * @param te The editor that this configuration is associated to
 */
public TexSourceViewerConfiguration(TexEditor editor) {        
    super(EditorsUI.getPreferenceStore());
    this.editor = editor;
    this.colorManager = new ColorManager();
    this.annotationHover = new TexAnnotationHover();

    // Adds a listener for changing content assistant properties if
    // these are changed in the preferences
    TexlipsePlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new  
            IPropertyChangeListener() {
        
        public void propertyChange(PropertyChangeEvent event) {
            
            if (assistant == null)
                return;
            
            String property = event.getProperty();
            if (TexlipseProperties.TEX_COMPLETION.equals(property)) {
                assistant.enableAutoActivation(
                        TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(
                                TexlipseProperties.TEX_COMPLETION));
            } else if (TexlipseProperties.TEX_COMPLETION_DELAY.equals(property)) {
                assistant.setAutoActivationDelay(
                        TexlipsePlugin.getDefault().getPreferenceStore().getInt(
                                TexlipseProperties.TEX_COMPLETION_DELAY));
            }
        };
    });
    
}
 
源代码26 项目: xds-ide   文件: ModulaSpellingHover.java
@Override
public IInformationControlCreator getHoverControlCreator() {
	return new IInformationControlCreator() {
		public IInformationControl createInformationControl(Shell parent) {
			return new HoverInformationControl(parent, EditorsUI.getTooltipAffordanceString());
		}
	};
}
 
源代码27 项目: xds-ide   文件: SpellCheckEngine.java
public final void propertyChange(final PropertyChangeEvent event) {
    if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED) && !EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) {
        if (this == fgEngine)
            SpellCheckEngine.shutdownInstance();
        else
            shutdown();
    }
}
 
源代码28 项目: xds-ide   文件: MarkOccurrencesPreferencePage.java
@Override
protected Control createContents(final Composite parent) {
    Composite composite= new Composite(parent, SWT.NONE);
    GridLayout layout= new GridLayout();
    layout.numColumns= 1;
    layout.marginHeight= 0;
    layout.marginWidth= 0;
    composite.setLayout(layout);

    Link link= new Link(composite, SWT.NONE);
    link.setText(Messages.MarkOccurrencesPreferencePage_LinkText);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            String data= null;
            AnnotationPreference preference= EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference("org.eclipse.jdt.ui.occurrences"); //$NON-NLS-1$
            if (preference != null)
                data= preference.getPreferenceLabel();
            PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, data);
        }
    });
    
    SWTFactory.createLabel(composite, "", 1); //$NON-NLS-1$
    
    cboxOnOff = SWTFactory.createCheckbox(composite, Messages.MarkOccurrencesPreferencePage_MarkOccurrencesOfElement, 1);
    
    initFromStore();
    return composite;
}
 
源代码29 项目: birt   文件: ScriptDebugHover.java
public IInformationControlCreator getHoverControlCreator( )
{
	return new IInformationControlCreator( ) {

		public IInformationControl createInformationControl( Shell parent )
		{
			return new DefaultInformationControl( parent,
					EditorsUI.getTooltipAffordanceString( ) );
		}
	};
}
 
源代码30 项目: xds-ide   文件: ModulaReconciler.java
/**
 * {@inheritDoc}
 */
@Override
public void uninstall() {
    EditorsUI.getPreferenceStore().removePropertyChangeListener(propertyChangeListener);
    propertyChangeListener = null;

    super.uninstall();
}
 
 类所在包
 同包方法