mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +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
|
||||
|
||||
new file wizards
|
||||
|
|
|
@ -29,6 +29,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
|
|||
private Menu fMenu;
|
||||
private IAction[] fActions;
|
||||
private IRegistryChangeListener fListener;
|
||||
private Object fLock = new Object();
|
||||
|
||||
public AbstractWizardDropDownAction() {
|
||||
fMenu= null;
|
||||
|
@ -46,11 +47,14 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
|
|||
|
||||
public void refreshActions() {
|
||||
// force menu and actions to be created again
|
||||
fActions = null;
|
||||
if (fMenu != null) {
|
||||
fMenu.dispose();
|
||||
fMenu = null;
|
||||
Menu oldMenu = null;
|
||||
synchronized(fLock) {
|
||||
oldMenu = fMenu;
|
||||
fActions = null;
|
||||
fMenu = null;
|
||||
}
|
||||
if (oldMenu != null)
|
||||
oldMenu.dispose();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
@ -58,11 +62,7 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
|
|||
Platform.getExtensionRegistry().removeRegistryChangeListener(fListener);
|
||||
fListener= null;
|
||||
}
|
||||
if (fMenu != null) {
|
||||
fMenu.dispose();
|
||||
fMenu= null;
|
||||
}
|
||||
fActions= null;
|
||||
refreshActions();
|
||||
}
|
||||
|
||||
public Menu getMenu(Menu parent) {
|
||||
|
@ -70,15 +70,17 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
|
|||
}
|
||||
|
||||
public Menu getMenu(Control parent) {
|
||||
if (fMenu == null) {
|
||||
fMenu= new Menu(parent);
|
||||
IAction[] actions= getActions();
|
||||
for (int i= 0; i < actions.length; i++) {
|
||||
ActionContributionItem item= new ActionContributionItem(actions[i]);
|
||||
item.fill(fMenu, -1);
|
||||
synchronized(fLock) {
|
||||
if (fMenu == null) {
|
||||
fMenu= new Menu(parent);
|
||||
IAction[] actions= getActions();
|
||||
for (int i= 0; i < actions.length; i++) {
|
||||
ActionContributionItem item= new ActionContributionItem(actions[i]);
|
||||
item.fill(fMenu, -1);
|
||||
}
|
||||
}
|
||||
return fMenu;
|
||||
}
|
||||
return fMenu;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
@ -106,14 +108,16 @@ public abstract class AbstractWizardDropDownAction extends Action implements IMe
|
|||
}
|
||||
|
||||
private IAction[] getActions() {
|
||||
if (fActions == null) {
|
||||
fActions = getWizardActions();
|
||||
if (fActions == null)
|
||||
fActions = NO_ACTIONS;
|
||||
|
||||
//TODO provide a way to sort the actions
|
||||
}
|
||||
return fActions;
|
||||
synchronized(fLock) {
|
||||
if (fActions == null) {
|
||||
fActions = getWizardActions();
|
||||
if (fActions == null)
|
||||
fActions = NO_ACTIONS;
|
||||
|
||||
//TODO provide a way to sort the actions
|
||||
}
|
||||
return fActions;
|
||||
}
|
||||
}
|
||||
|
||||
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.NotASourceFolder=Folder ''{0}'' is not a source folder.
|
||||
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.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.title= New Header File
|
||||
|
||||
|
@ -47,6 +43,7 @@ NewHeaderFileCreationWizardPage.error.FileNotInSourceFolder=File must be inside
|
|||
NewHeaderFileCreationWizardPage.error.FileExists=File 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.FolderDoesNotExist=Folder ''{0}'' does not exist.
|
||||
NewHeaderFileCreationWizardPage.warning.FileNameDiscouraged=File name is discouraged. {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.MatchingFolderExists=A folder 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.error.InvalidFileName=File name is not valid. {0}.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue