📄 removemusicfolderaction.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.actions;import org.eclipse.jface.action.IAction;import org.eclipse.jface.viewers.ISelection;import org.eclipse.jface.viewers.StructuredSelection;import org.eclipse.ui.IWorkbenchWindow;import org.eclipse.ui.IWorkbenchWindowActionDelegate;import com.siemens.ct.mp3m.ModelInitializer;import com.siemens.ct.mp3m.model.physical.Mp3Directory;import com.siemens.ct.mp3m.model.physical.MusicFolders;public class RemoveMusicFolderAction implements IWorkbenchWindowActionDelegate { private String selectedDirectory; public void run(IAction action) { MusicFolders.removeMusicFolder(selectedDirectory); ModelInitializer.createTree(); } public void dispose() { // TODO Auto-generated method stub } public void init(IWorkbenchWindow window) { } public void selectionChanged(IAction action, ISelection selection) { if (!selection.isEmpty()) { StructuredSelection structuredSelection = (StructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof Mp3Directory) { String folder = ((Mp3Directory) structuredSelection.getFirstElement()).getName(); if (MusicFolders.contains(folder)) { action.setEnabled(true); selectedDirectory = folder; return; } else { action.setEnabled(false); } } } action.setEnabled(false); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -