📄 albumwizard.java
字号:
/*******************************************************************************
* Copyright (c) 2007 Siemens AG
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Kai T鰀ter - initial API and implementation
*******************************************************************************/
package com.siemens.ct.mp3m.ui.wizards;
import java.util.List;
import org.eclipse.jface.wizard.Wizard;
import com.siemens.ct.mp3m.model.IMP3Info;
import com.siemens.ct.mp3m.model.MP3Infos;
import com.siemens.ct.mp3m.model.logical.Artists;
/**
* A simple Wizard do demonstrate the Wizard concept. Here the user can select
* an artist and an album of that artist. Afterwards the name of the album will
* be changed and all MP3 files that match with artist and old album name will
* be retagged to the new album name.
*
* @author Kai Toedter
* @author $LastChangedBy: toedter_k $
* @version $LastChangedDate: 2007-02-22 10:13:57 +0100 (Do, 22 Feb 2007) $
* @version $LastChangedRevision: 469 $
*
*/
public class AlbumWizard extends Wizard {
private AlbumSelectionPage albumSelectionPage;
private AlbumRenamePage albumRenamepage;
private AlbumWizardModel model;
public AlbumWizard() {
setWindowTitle("Album Wizard");
model = new AlbumWizardModel();
}
@Override
public void addPages() {
albumSelectionPage = new AlbumSelectionPage(model);
addPage(albumSelectionPage);
albumRenamepage = new AlbumRenamePage(model);
addPage(albumRenamepage);
}
@Override
public boolean performFinish() {
List<IMP3Info> mp3Infos = MP3Infos.getMP3Infos();
for(IMP3Info info: mp3Infos) {
if(info.getArtist().equals(model.getArtist()) && info.getAlbum().equals(model.getOldName())) {
info.setAlbum(model.getNewName());
info.saveMP3File();
}
}
Artists.recomputeModel();
return true;
}
@Override
public boolean canFinish() {
// cannot complete the wizard from the album selection page
if (this.getContainer().getCurrentPage() == albumSelectionPage)
return false;
return albumRenamepage.checkStatus(false).isOK();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -