From 6a1d191ecf23093a2c29518906619303febd4785 Mon Sep 17 00:00:00 2001 From: Kai Maetzel Date: Wed, 5 Feb 2003 10:19:12 +0000 Subject: updated example --- .../examples/javaeditor/JavaActionContributor.java | 30 +++++------------ .../examples/javaeditor/JavaDocumentProvider.java | 17 +++------- .../eclipse/ui/examples/javaeditor/JavaEditor.java | 32 +++++++++--------- .../javaeditor/JavaSourceViewerConfiguration.java | 39 +++++----------------- .../ui/examples/javaeditor/PresentationAction.java | 15 +++------ 5 files changed, 42 insertions(+), 91 deletions(-) (limited to 'org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui') diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java index ecf3178b7f6..6c5b2c246ad 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaActionContributor.java @@ -1,28 +1,14 @@ -/********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation -**********************************************************************/ - package org.eclipse.ui.examples.javaeditor; +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.Separator; - -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.jface.action.*; +import org.eclipse.ui.*; import org.eclipse.ui.editors.text.TextEditorActionContributor; -import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.ui.texteditor.RetargetTextEditorAction; -import org.eclipse.ui.texteditor.TextEditorAction; +import org.eclipse.ui.texteditor.*; /** * Contributes interesting Java actions to the desktop's Edit menu and the toolbar. @@ -39,7 +25,9 @@ public class JavaActionContributor extends TextEditorActionContributor { public JavaActionContributor() { super(); fContentAssistProposal= new RetargetTextEditorAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$ + fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); fContentAssistTip= new RetargetTextEditorAction(JavaEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$ + fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); fTogglePresentation= new PresentationAction(); } diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentProvider.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentProvider.java index 22ab20735d4..a78662ffcc4 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentProvider.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaDocumentProvider.java @@ -1,23 +1,14 @@ -/********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation -**********************************************************************/ - package org.eclipse.ui.examples.javaeditor; +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ import org.eclipse.core.runtime.CoreException; - import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.rules.DefaultPartitioner; - import org.eclipse.ui.editors.text.FileDocumentProvider; import org.eclipse.ui.examples.javaeditor.java.JavaPartitionScanner; diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java index 00b0cf7dc30..3ce2ef99520 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaEditor.java @@ -1,33 +1,27 @@ -/********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation -**********************************************************************/ - package org.eclipse.ui.examples.javaeditor; +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.text.source.ISourceViewer; - import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.editors.text.ProjectionTextEditor; +import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.texteditor.DefaultRangeIndicator; +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; import org.eclipse.ui.texteditor.TextOperationAction; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; /** * Java specific text editor. */ -public class JavaEditor extends ProjectionTextEditor { +public class JavaEditor extends TextEditor { /** The outline page */ private JavaContentOutlinePage fOutlinePage; @@ -45,8 +39,14 @@ public class JavaEditor extends ProjectionTextEditor { */ protected void createActions() { super.createActions(); - setAction("ContentAssistProposal", new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS)); //$NON-NLS-1$ //$NON-NLS-2$ - setAction("ContentAssistTip", new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION)); //$NON-NLS-1$ //$NON-NLS-2$ + + IAction a= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS); //$NON-NLS-1$ + a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); + setAction("ContentAssistProposal", a); //$NON-NLS-1$ + + a= new TextOperationAction(JavaEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$ + a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); + setAction("ContentAssistTip", a); //$NON-NLS-1$ } /** The JavaEditor implementation of this diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java index 4b65f87ae33..9e18c45c215 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/JavaSourceViewerConfiguration.java @@ -1,40 +1,19 @@ -/********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation -**********************************************************************/ - package org.eclipse.ui.examples.javaeditor; +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ -import org.eclipse.swt.graphics.RGB; - -import org.eclipse.jface.text.DefaultAutoIndentStrategy; -import org.eclipse.jface.text.IAutoIndentStrategy; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextDoubleClickStrategy; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.*; import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.contentassist.IContentAssistant; import org.eclipse.jface.text.presentation.IPresentationReconciler; import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.rules.BufferedRuleBasedScanner; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; - -import org.eclipse.ui.examples.javaeditor.java.JavaAutoIndentStrategy; -import org.eclipse.ui.examples.javaeditor.java.JavaCompletionProcessor; -import org.eclipse.ui.examples.javaeditor.java.JavaDoubleClickSelector; -import org.eclipse.ui.examples.javaeditor.java.JavaPartitionScanner; +import org.eclipse.jface.text.rules.*; +import org.eclipse.jface.text.source.*; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.ui.examples.javaeditor.java.*; import org.eclipse.ui.examples.javaeditor.javadoc.JavaDocCompletionProcessor; import org.eclipse.ui.examples.javaeditor.util.JavaColorProvider; diff --git a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java index cc1ad334625..9f9e6b003b4 100644 --- a/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java +++ b/org.eclipse.ui.examples.javaeditor/Eclipse Java Editor Example/org/eclipse/ui/examples/javaeditor/PresentationAction.java @@ -1,16 +1,9 @@ -/********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v10.html - -Contributors: - IBM Corporation - Initial implementation -**********************************************************************/ - package org.eclipse.ui.examples.javaeditor; +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.TextEditorAction; -- cgit v1.2.3