Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.ui.editors/icons/full/dtool16/new_untitled_text_file.gifbin0 -> 354 bytes
-rw-r--r--org.eclipse.ui.editors/icons/full/etool16/new_untitled_text_file.gifbin0 -> 354 bytes
-rw-r--r--org.eclipse.ui.editors/plugin.properties8
-rw-r--r--org.eclipse.ui.editors/plugin.xml49
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java (renamed from org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NewTextEditorAction.java)79
5 files changed, 66 insertions, 70 deletions
diff --git a/org.eclipse.ui.editors/icons/full/dtool16/new_untitled_text_file.gif b/org.eclipse.ui.editors/icons/full/dtool16/new_untitled_text_file.gif
new file mode 100644
index 00000000000..b226e41c527
--- /dev/null
+++ b/org.eclipse.ui.editors/icons/full/dtool16/new_untitled_text_file.gif
Binary files differ
diff --git a/org.eclipse.ui.editors/icons/full/etool16/new_untitled_text_file.gif b/org.eclipse.ui.editors/icons/full/etool16/new_untitled_text_file.gif
new file mode 100644
index 00000000000..b226e41c527
--- /dev/null
+++ b/org.eclipse.ui.editors/icons/full/etool16/new_untitled_text_file.gif
Binary files differ
diff --git a/org.eclipse.ui.editors/plugin.properties b/org.eclipse.ui.editors/plugin.properties
index c12d09ed27a..a0bf2c61c25 100644
--- a/org.eclipse.ui.editors/plugin.properties
+++ b/org.eclipse.ui.editors/plugin.properties
@@ -36,9 +36,8 @@ openExternalFile.name= Open File...
openExternalFile.label= Open File&...
openExternalFile.description= Opens a File
-newTextEditor.name= Open Untitled Text File
-newTextEditor.label= Open &Untitled Text File
-newTextEditor.description= Creates and opens an empty untitled text file
+NewUntitledTextFile.label= Untitled Text File
+NewUntitledTextFile.description= Creates an empty untitled text file
ActionDefinition.quickDiff.name= Quick Diff Toggle
ActionDefinition.quickDiff.description= Toggles quick diff information display on the line number ruler
@@ -69,8 +68,7 @@ quickdiff.toggle.enable= Enable &QuickDiff
Dummy.label=
-openExternalFileActionSet.label= Open External Files
-newTextEditorActionSet.label= Open Untitled Text Files
+openFilesActionSet.label= Open Files
textEditorAnnotationNavigationActionSet.label= Annotation Navigation
goToPreviousAnnotation.label= Previous Annotation
diff --git a/org.eclipse.ui.editors/plugin.xml b/org.eclipse.ui.editors/plugin.xml
index ba95a585de5..fb697d0f0a4 100644
--- a/org.eclipse.ui.editors/plugin.xml
+++ b/org.eclipse.ui.editors/plugin.xml
@@ -57,13 +57,6 @@
id="org.eclipse.ui.edit.text.openExternalFile">
</command>
<command
- name="%newTextEditor.name"
- categoryId="org.eclipse.ui.category.file"
- description="%newTextEditor.description"
- id="org.eclipse.ui.edit.text.newTextEditor">
- </command>
-
- <command
name="%ActionDefinition.quickDiff.name"
categoryId="org.eclipse.ui.category.edit"
description="%ActionDefinition.quickDiff.description"
@@ -312,10 +305,36 @@
</action>
</editorContribution>
</extension>
+
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ name="%NewUntitledTextFile.label"
+ icon="icons/full/etool16/new_untitled_text_file.gif"
+ category="org.eclipse.ui.Basic"
+ class="org.eclipse.ui.internal.editors.text.UntitledTextFileWizard"
+ canFinishEarly="true"
+ hasPages="false"
+ id="org.eclipse.ui.editors.wizards.UntitledTextFileWizard">
+ <description>
+ %NewUntitledTextFile.description
+ </description>
+ </wizard>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.ui.resourcePerspective">
+ <newWizardShortcut
+ id="org.eclipse.ui.editors.wizards.UntitledTextFileWizard">
+ </newWizardShortcut>
+ </perspectiveExtension>
+ </extension>
+
<extension
point="org.eclipse.ui.actionSets">
<actionSet
- label="%openExternalFileActionSet.label"
+ label="%openFilesActionSet.label"
visible="true"
id="org.eclipse.ui.edit.text.actionSet.openExternalFile">
<action
@@ -329,20 +348,6 @@
</action>
</actionSet>
<actionSet
- label="%newTextEditorActionSet.label"
- visible="true"
- id="org.eclipse.ui.edit.text.actionSet.newTextEditor">
- <action
- definitionId="org.eclipse.ui.edit.text.newTextEditor"
- label="%newTextEditor.label"
- helpContextId="new_text_editor_action_context"
- class="org.eclipse.ui.internal.editors.text.NewTextEditorAction"
- tooltip="%newTextEditor.description"
- menubarPath="file/new.ext"
- id="org.eclipse.ui.edit.text.newTextEditor">
- </action>
- </actionSet>
- <actionSet
label="%textEditorAnnotationNavigationActionSet.label"
visible="false"
id="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NewTextEditorAction.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java
index 3e62ade60a9..20200998f57 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/NewTextEditorAction.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/UntitledTextFileWizard.java
@@ -11,29 +11,34 @@
package org.eclipse.ui.internal.editors.text;
import java.io.File;
+
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+
+import org.eclipse.ui.editors.text.EditorsUI;
+
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.editors.text.EditorsUI;
/**
+ * Wizard with no page that creates the untitled text file
+ * and opens the text editor.
+ *
* @since 3.1
*/
-public class NewTextEditorAction extends Action implements IWorkbenchWindowActionDelegate {
+public class UntitledTextFileWizard extends Wizard implements INewWizard {
private IWorkbenchWindow fWindow;
- public NewTextEditorAction() {
- setEnabled(true);
+ public UntitledTextFileWizard() {
}
/*
@@ -43,31 +48,29 @@ public class NewTextEditorAction extends Action implements IWorkbenchWindowActio
fWindow= null;
}
- /*
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- fWindow= window;
+ private File queryFile() {
+ IPath stateLocation= EditorsPlugin.getDefault().getStateLocation();
+ IPath path= stateLocation.append("/_" + new Object().hashCode()); //$NON-NLS-1$ //$NON-NLS-2$
+ return new File(path.toOSString());
}
- /*
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- run();
+ private String getEditorId(File file) {
+ IWorkbench workbench= fWindow.getWorkbench();
+ IEditorRegistry editorRegistry= workbench.getEditorRegistry();
+ IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName());
+ if (descriptor != null)
+ return descriptor.getId();
+ return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
- /*
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
+ private IEditorInput createEditorInput(File file) {
+ return new NonExistingFileEditorInput(file, TextEditorMessages.NewTextEditorAction_namePrefix);
}
/*
- * @see org.eclipse.jface.action.Action#run()
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
- public void run() {
+ public boolean performFinish() {
File file= queryFile();
IEditorInput input= createEditorInput(file);
String editorId= getEditorId(file);
@@ -75,26 +78,16 @@ public class NewTextEditorAction extends Action implements IWorkbenchWindowActio
try {
page.openEditor(input, editorId);
} catch (PartInitException e) {
- e.printStackTrace();
+ EditorsPlugin.log(e);
+ return false;
}
+ return true;
}
- private File queryFile() {
- IPath stateLocation= EditorsPlugin.getDefault().getStateLocation();
- IPath path= stateLocation.append("/_" + new Object().hashCode()); //$NON-NLS-1$ //$NON-NLS-2$
- return new File(path.toOSString());
- }
-
- private String getEditorId(File file) {
- IWorkbench workbench= fWindow.getWorkbench();
- IEditorRegistry editorRegistry= workbench.getEditorRegistry();
- IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName());
- if (descriptor != null)
- return descriptor.getId();
- return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
- }
-
- private IEditorInput createEditorInput(File file) {
- return new NonExistingFileEditorInput(file, TextEditorMessages.NewTextEditorAction_namePrefix);
+ /*
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ fWindow= workbench.getActiveWorkbenchWindow();
}
}

Back to the top