提交 14160cb7 编写于 作者: S Serge Rider

#6883 Task wizard icons & dialog title


Former-commit-id: a911d9ef
上级 b530d550
......@@ -170,6 +170,8 @@ public class DataTransferWizard extends TaskConfigurationWizard implements IExpo
addNodeSettings(node);
}
}
updateWizardTitle();
}
@Override
......
......@@ -73,6 +73,7 @@ public class DBIcon implements DBPImage
public static final DBIcon TREE_SESSIONS = new DBIcon("sessions", "tree/sessions.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon TREE_LOCKS = new DBIcon("locks", "tree/locks.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon TREE_PACKAGE = new DBIcon("package", "tree/package.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon TREE_TASK = new DBIcon("task", "tree/task.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon TREE_DATA_TYPE = new DBIcon("data_type", "tree/data_type.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon TREE_SEQUENCE = new DBIcon("sequence", "tree/sequence.png"); //$NON-NLS-1$ //$NON-NLS-2$
public static final DBIcon TREE_SYNONYM = new DBIcon("synonym", "tree/synonym.png"); //$NON-NLS-1$ //$NON-NLS-2$
......
......@@ -3,5 +3,6 @@ output.. = target/classes/
bin.includes = .,\
META-INF/,\
OSGI-INF/,\
icons/,\
schema/,\
plugin.xml
......@@ -66,7 +66,7 @@
category="org.jkiss.dbeaver.core.category"
class="org.jkiss.dbeaver.ui.task.DatabaseTasksView"
allowMultiple="false"
icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/package.png"
icon="icons/task_list.png"
name="%view.tasks.title"/>
</extension>
......@@ -312,6 +312,7 @@
<image commandId="org.jkiss.dbeaver.ui.tools.select.schema" icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/schema.png"/>
<image commandId="org.jkiss.dbeaver.task.run" icon="platform:/plugin/org.jkiss.dbeaver.ui/icons/run.png"/>
<image commandId="org.jkiss.dbeaver.task.create" icon="icons/task_create.png"/>
</extension>
<extension point="org.eclipse.ui.handlers">
......@@ -845,14 +846,14 @@
<menuContribution allPopups="false" locationURI="toolbar:dbeaver-tools?after=additions">
<separator name="tasks" visible="true"/>
<command commandId="org.eclipse.ui.views.showView" icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/package.png" label="%view.tasks.title" style="pulldown" id="org.jkiss.dbeaver.menu.tasks">
<command commandId="org.eclipse.ui.views.showView" icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/task.png" label="%view.tasks.title" style="pulldown" id="org.jkiss.dbeaver.menu.tasks">
<parameter name="org.eclipse.ui.views.showView.viewId" value="org.jkiss.dbeaver.tasks"/>
</command>
</menuContribution>
<menuContribution allPopups="false" locationURI="menu:org.jkiss.dbeaver.menu.tasks">
<command commandId="org.jkiss.dbeaver.task.create"/>
<command commandId="org.eclipse.ui.views.showView" icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/package.png" label="%view.tasks.title" style="pulldown" id="org.jkiss.dbeaver.menu.tasks">
<command commandId="org.eclipse.ui.views.showView" icon="platform:/plugin/org.jkiss.dbeaver.model/icons/tree/task.png" label="%view.tasks.title" style="pulldown" id="org.jkiss.dbeaver.menu.tasks">
<parameter name="org.eclipse.ui.views.showView.viewId" value="org.jkiss.dbeaver.tasks"/>
</command>
<separator name="tasks" visible="true"/>
......
......@@ -150,7 +150,7 @@ public class DatabaseTasksView extends ViewPart implements DBTTaskListener {
@Override
protected DBPImage getCellImage(DBTTask task) {
DBPImage icon = task.getType().getIcon();
return icon != null ? icon : DBIcon.TREE_PACKAGE;
return icon != null ? icon : DBIcon.TREE_TASK;
}
@Override
......
......@@ -64,7 +64,7 @@ public class EditTaskConfigurationDialog extends BaseDialog
{
super(parentShell,
"Edit task [" + task.getName() + "]",
task.getType().getIcon() == null ? DBIcon.TREE_PACKAGE : task.getType().getIcon());
task.getType().getIcon() == null ? DBIcon.TREE_TASK: task.getType().getIcon());
this.task = (TaskImpl) task;
this.project = task.getProject();
this.taskType = task.getType();
......@@ -73,7 +73,7 @@ public class EditTaskConfigurationDialog extends BaseDialog
public EditTaskConfigurationDialog(Shell parentShell, @NotNull DBPProject project, @NotNull DBTTaskType taskType)
{
super(parentShell, "Create task", DBIcon.TREE_PACKAGE);
super(parentShell, "Create task", DBIcon.TREE_TASK);
this.task = null;
this.project = project;
this.taskType = taskType;
......
......@@ -58,7 +58,7 @@ public class RecentTasksMenuContributor extends DataSourceMenuContributor
for (int i = 0; i < tasks.length && i <= MAX_ITEMS; i++) {
DBTTask task = tasks[i];
DBPImage taskIcon = task.getType().getIcon();
if (taskIcon == null) taskIcon = DBIcon.TREE_PACKAGE;
if (taskIcon == null) taskIcon = DBIcon.TREE_TASK;
menuItems.add(ActionUtils.makeActionContribution(new Action(task.getName(), DBeaverIcons.getImageDescriptor(taskIcon)) {
@Override
public void run() {
......
......@@ -77,7 +77,8 @@ public abstract class TaskConfigurationWizard extends BaseWizard implements IWor
protected void updateWizardTitle() {
String wizTitle = getDefaultWindowTitle();
if (isTaskEditor()) {
wizTitle += " - [" + currentTask.getName() + "]";
TaskConfigurationWizardPageTask taskPage = getContainer().getTaskPage();
wizTitle += " - [" + (taskPage == null ? currentTask.getName() : taskPage.getTaskName()) + "]";
}
setWindowTitle(wizTitle);
}
......@@ -92,6 +93,7 @@ public abstract class TaskConfigurationWizard extends BaseWizard implements IWor
updateWizardTitle();
setNeedsProgressMonitor(true);
this.currentSelection = currentSelection;
getContainer().addPageChangedListener(event -> updateWizardTitle());
}
@Override
......
......@@ -16,6 +16,8 @@
*/
package org.jkiss.dbeaver.ui.task;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.ModifyListener;
......@@ -23,6 +25,8 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBIcon;
......@@ -250,7 +254,7 @@ class TaskConfigurationWizardPageTask extends ActiveWizardPage
for (DBTTaskCategory cat : categories) {
TreeItem item = parentItem == null ? new TreeItem(taskCategoryTree, SWT.NONE) : new TreeItem(parentItem, SWT.NONE);
item.setText(cat.getName());
item.setImage(DBeaverIcons.getImage(cat.getIcon() == null ? DBIcon.TREE_PACKAGE : cat.getIcon()));
item.setImage(DBeaverIcons.getImage(cat.getIcon() == null ? DBIcon.TREE_TASK : cat.getIcon()));
item.setData(cat);
addTaskCategories(item, cat.getChildren());
item.setExpanded(true);
......@@ -277,6 +281,12 @@ class TaskConfigurationWizardPageTask extends ActiveWizardPage
task = (TaskImpl) selectedProject.getTaskManager().createTaskConfiguration(selectedTaskType, CommonUtils.notEmpty(taskName), taskDescription, new LinkedHashMap<>());
}
realWizard = (TaskConfigurationWizard) configurator.createTaskConfigWizard(task);
IWorkbenchWindow workbenchWindow = UIUtils.getActiveWorkbenchWindow();
IWorkbenchPart activePart = workbenchWindow.getActivePage().getActivePart();
ISelection selection = activePart == null || activePart.getSite() == null || activePart.getSite().getSelectionProvider() == null ?
null : activePart.getSite().getSelectionProvider().getSelection();
realWizard.setContainer(getContainer());
realWizard.init(workbenchWindow.getWorkbench(), selection instanceof IStructuredSelection ? (IStructuredSelection) selection : null);
taskConfigPanel.saveSettings();
taskWizards.put(selectedTaskType, realWizard);
......
......@@ -77,7 +77,7 @@ public class TaskHandlerRun extends AbstractHandler implements IElementUpdater {
DBTTask task = NavigatorUtils.getSelectedProject().getTaskManager().getTaskConfiguration(taskId);
if (task != null) {
DBPImage taskIcon = task.getType().getIcon();
if (taskIcon == null) taskIcon = DBIcon.TREE_PACKAGE;
if (taskIcon == null) taskIcon = DBIcon.TREE_TASK;
element.setIcon(DBeaverIcons.getImageDescriptor(taskIcon));
element.setText(task.getName());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册