1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 22:05:44 +02:00

2004-09-22 Chris Wiebe

add lock for safety
	* src/org/eclipse/cdt/internal/ui/wizards/AbstractWizardDropDownAction.java
	* src/org/eclipse/cdt/internal/ui/wizards/filewizard/NewFileWizardMessages.properties
This commit is contained in:
Chris Wiebe 2004-09-22 20:38:30 +00:00
parent cb338485bf
commit e3e2d54b82
3 changed files with 37 additions and 29 deletions

View file

@ -1,3 +1,9 @@
2004-09-22 Chris Wiebe
add lock for safety
* src/org/eclipse/cdt/internal/ui/wizards/AbstractWizardDropDownAction.java
* src/org/eclipse/cdt/internal/ui/wizards/filewizard/NewFileWizardMessages.properties
2004-09-22 Chris Wiebe 2004-09-22 Chris Wiebe
new file wizards new file wizards

View file

@ -29,6 +29,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
private Menu fMenu; private Menu fMenu;
private IAction[] fActions; private IAction[] fActions;
private IRegistryChangeListener fListener; private IRegistryChangeListener fListener;
private Object fLock = new Object();
public AbstractWizardDropDownAction() { public AbstractWizardDropDownAction() {
fMenu= null; fMenu= null;
@ -46,11 +47,14 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
public void refreshActions() { public void refreshActions() {
// force menu and actions to be created again // force menu and actions to be created again
Menu oldMenu = null;
synchronized(fLock) {
oldMenu = fMenu;
fActions = null; fActions = null;
if (fMenu != null) {
fMenu.dispose();
fMenu = null; fMenu = null;
} }
if (oldMenu != null)
oldMenu.dispose();
} }
public void dispose() { public void dispose() {
@ -58,11 +62,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
Platform.getExtensionRegistry().removeRegistryChangeListener(fListener); Platform.getExtensionRegistry().removeRegistryChangeListener(fListener);
fListener= null; fListener= null;
} }
if (fMenu != null) { refreshActions();
fMenu.dispose();
fMenu= null;
}
fActions= null;
} }
public Menu getMenu(Menu parent) { public Menu getMenu(Menu parent) {
@ -70,6 +70,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
} }
public Menu getMenu(Control parent) { public Menu getMenu(Control parent) {
synchronized(fLock) {
if (fMenu == null) { if (fMenu == null) {
fMenu= new Menu(parent); fMenu= new Menu(parent);
IAction[] actions= getActions(); IAction[] actions= getActions();
@ -80,6 +81,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
} }
return fMenu; return fMenu;
} }
}
public void run() { public void run() {
// for now, run the default action // for now, run the default action
@ -106,6 +108,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
} }
private IAction[] getActions() { private IAction[] getActions() {
synchronized(fLock) {
if (fActions == null) { if (fActions == null) {
fActions = getWizardActions(); fActions = getWizardActions();
if (fActions == null) if (fActions == null)
@ -115,6 +118,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
} }
return fActions; return fActions;
} }
}
protected abstract IAction[] getWizardActions(); protected abstract IAction[] getWizardActions();

View file

@ -25,13 +25,9 @@ AbstractFileCreationWizardPage.error.EnterSourceFolderName=Source folder name is
AbstractFileCreationWizardPage.error.NotAFolder=''{0}'' is not a project or folder. AbstractFileCreationWizardPage.error.NotAFolder=''{0}'' is not a project or folder.
AbstractFileCreationWizardPage.error.NotASourceFolder=Folder ''{0}'' is not a source folder. AbstractFileCreationWizardPage.error.NotASourceFolder=Folder ''{0}'' is not a source folder.
AbstractFileCreationWizardPage.error.ProjectClosed=Project ''{0}'' must be accessible. AbstractFileCreationWizardPage.error.ProjectClosed=Project ''{0}'' must be accessible.
NewHeaderFileCreationWizardPagewarning.NotACProject=Folder is not a C/C++ project. AbstractFileCreationWizardPagewarning.NotACProject=Folder is not a C/C++ project.
AbstractFileCreationWizardPage.warning.NotInACProject=Folder is not in a C/C++ project. AbstractFileCreationWizardPage.warning.NotInACProject=Folder is not in a C/C++ project.
AbstractFileCreationWizardPage.error.NotAFile=''{0}'' is not a file.
AbstractFileCreationWizardPage.error.FolderDoesNotExist=Folder ''{0}'' does not exist.
AbstractFileCreationWizardPage.error.SourceFolderRequired=The source folder is required.
# ------- NewHeaderFileCreationWizard ------- # ------- NewHeaderFileCreationWizard -------
NewHeaderFileCreationWizard.title= New Header File NewHeaderFileCreationWizard.title= New Header File
@ -47,6 +43,7 @@ NewHeaderFileCreationWizardPage.error.FileNotInSourceFolder=File must be inside
NewHeaderFileCreationWizardPage.error.FileExists=File already exists. NewHeaderFileCreationWizardPage.error.FileExists=File already exists.
NewHeaderFileCreationWizardPage.error.MatchingFolderExists=A folder with the same name already exists. NewHeaderFileCreationWizardPage.error.MatchingFolderExists=A folder with the same name already exists.
NewHeaderFileCreationWizardPage.error.MatchingResourceExists=A resource with the same name already exists. NewHeaderFileCreationWizardPage.error.MatchingResourceExists=A resource with the same name already exists.
NewHeaderFileCreationWizardPage.error.FolderDoesNotExist=Folder ''{0}'' does not exist.
NewHeaderFileCreationWizardPage.warning.FileNameDiscouraged=File name is discouraged. {0}. NewHeaderFileCreationWizardPage.warning.FileNameDiscouraged=File name is discouraged. {0}.
NewHeaderFileCreationWizardPage.error.InvalidFileName=File name is not valid. {0}. NewHeaderFileCreationWizardPage.error.InvalidFileName=File name is not valid. {0}.
@ -59,6 +56,7 @@ NewSourceFileCreationWizardPage.error.FileNotInSourceFolder=File must be inside
NewSourceFileCreationWizardPage.error.FileExists=File already exists. NewSourceFileCreationWizardPage.error.FileExists=File already exists.
NewSourceFileCreationWizardPage.error.MatchingFolderExists=A folder with the same name already exists. NewSourceFileCreationWizardPage.error.MatchingFolderExists=A folder with the same name already exists.
NewSourceFileCreationWizardPage.error.MatchingResourceExists=A resource with the same name already exists. NewSourceFileCreationWizardPage.error.MatchingResourceExists=A resource with the same name already exists.
NewSourceFileCreationWizardPage.error.FolderDoesNotExist=Folder ''{0}'' does not exist.
NewSourceFileCreationWizardPage.warning.FileNameDiscouraged=File name is discouraged. {0}. NewSourceFileCreationWizardPage.warning.FileNameDiscouraged=File name is discouraged. {0}.
NewSourceFileCreationWizardPage.error.InvalidFileName=File name is not valid. {0}. NewSourceFileCreationWizardPage.error.InvalidFileName=File name is not valid. {0}.