mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 21:35:40 +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:
parent
cb338485bf
commit
e3e2d54b82
3 changed files with 37 additions and 29 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
fActions = null;
|
Menu oldMenu = null;
|
||||||
if (fMenu != null) {
|
synchronized(fLock) {
|
||||||
fMenu.dispose();
|
oldMenu = fMenu;
|
||||||
fMenu = null;
|
fActions = 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,15 +70,17 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
|
||||||
}
|
}
|
||||||
|
|
||||||
public Menu getMenu(Control parent) {
|
public Menu getMenu(Control parent) {
|
||||||
if (fMenu == null) {
|
synchronized(fLock) {
|
||||||
fMenu= new Menu(parent);
|
if (fMenu == null) {
|
||||||
IAction[] actions= getActions();
|
fMenu= new Menu(parent);
|
||||||
for (int i= 0; i < actions.length; i++) {
|
IAction[] actions= getActions();
|
||||||
ActionContributionItem item= new ActionContributionItem(actions[i]);
|
for (int i= 0; i < actions.length; i++) {
|
||||||
item.fill(fMenu, -1);
|
ActionContributionItem item= new ActionContributionItem(actions[i]);
|
||||||
|
item.fill(fMenu, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return fMenu;
|
||||||
}
|
}
|
||||||
return fMenu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -106,14 +108,16 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
|
||||||
}
|
}
|
||||||
|
|
||||||
private IAction[] getActions() {
|
private IAction[] getActions() {
|
||||||
if (fActions == null) {
|
synchronized(fLock) {
|
||||||
fActions = getWizardActions();
|
if (fActions == null) {
|
||||||
if (fActions == null)
|
fActions = getWizardActions();
|
||||||
fActions = NO_ACTIONS;
|
if (fActions == null)
|
||||||
|
fActions = NO_ACTIONS;
|
||||||
//TODO provide a way to sort the actions
|
|
||||||
}
|
//TODO provide a way to sort the actions
|
||||||
return fActions;
|
}
|
||||||
|
return fActions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IAction[] getWizardActions();
|
protected abstract IAction[] getWizardActions();
|
||||||
|
|
|
@ -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}.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue