| org.netbeans.modules.visualweb.palette.api.CodeClipPaletteActions
CodeClipPaletteActions | public class CodeClipPaletteActions extends PaletteActions (Code) | | |
CodeClipPaletteActions | public CodeClipPaletteActions(String paletteFolderName, CloneableEditor cloneableEditor)(Code) | | |
deleteDir | public static boolean deleteDir(File dir)(Code) | | No longer necessary since the Palette API now provides this in the manager.
Reset Palette
private static class ResetPaletteAction extends AbstractAction {
String folderName;
ResetPaletteAction(String folderName) {
super( NbBundle.getMessage(CodeClipPaletteActions.class, "RESET"));
this.folderName = folderName;
}
public void actionPerformed(ActionEvent e) {
String msg;
FileSystem fs = Repository.getDefault().getDefaultFileSystem();
FileObject paletteFileObject = fs.findResource( folderName );
FileObject paletteParent = paletteFileObject.getParent();
String nbUserDir = System.getProperty("netbeans.user");
String separator = new File(nbUserDir).separator;
File userPaletteFolder = new File(nbUserDir + separator + "config" + separator + paletteFileObject.getPath());
if ( !userPaletteFolder.isDirectory() ){
msg = NbBundle.getMessage(CodeClipPaletteActions.class, "MSG_NoUserModifications");
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
return;
}
msg = NbBundle.getMessage(CodeClipPaletteActions.class, "MSG_OkayToDelete");
// Object option = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.OK_CANCEL_OPTION));
NotifyDescriptor d =new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.OK_CANCEL_OPTION);
if (DialogDisplayer.getDefault().notify(d) != NotifyDescriptor.OK_OPTION ){
return;
}
boolean success = deleteDir(userPaletteFolder);
if( !success ) {
msg = NbBundle.getMessage(CodeClipPaletteActions.class, "MSG_ErrorUnableToDeleteUserPaletteFolder");
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE));
return;
}
//It is insufficient to refresh paletteFileObject since itself has been removed from the user dir.
paletteParent.refresh();
}
}
|
getCustomCategoryActions | public Action[] getCustomCategoryActions(Lookup category)(Code) | | |
getCustomItemActions | public Action[] getCustomItemActions(Lookup item)(Code) | | |
getCustomPaletteActions | public Action[] getCustomPaletteActions()(Code) | | |
getPreferredAction | public Action getPreferredAction(Lookup item)(Code) | | |
|
|