提交 7fda56b9 编写于 作者: S Serge Rider

#5191 Dashboard view, commands stubs


Former-commit-id: 9045bcda
上级 fbbe460b
......@@ -3,7 +3,7 @@ Bundle-Name = DBeaver Dashboard UI
extension-point.org.jkiss.dbeaver.dashboard.name = Dashboard
view.dashboard.title = Dashboard
view.dashboard.title = Database Dashboard
wizard.org.jkiss.dbeaver.dashboard.new.dashboard.name = Dashboard
wizard.org.jkiss.dbeaver.dashboard.new.dashboard.description = Create custom dashboard
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.dashboard.registry;
import org.eclipse.core.runtime.IConfigurationElement;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.app.DBPPlatformLanguage;
import org.jkiss.dbeaver.model.impl.AbstractContextDescriptor;
/**
* DashboardDescriptor
*/
public class DashboardDescriptor extends AbstractContextDescriptor implements DBPPlatformLanguage
{
public static final String EXTENSION_ID = "org.jkiss.dbeaver.dashboard"; //$NON-NLS-1$
private final String id;
private final String label;
private final String description;
public DashboardDescriptor(
IConfigurationElement config)
{
super(config);
this.id = config.getAttribute("id");
this.label = config.getAttribute("label");
this.description = config.getAttribute("description");
}
@NotNull
@Override
public String getId() {
return id;
}
@NotNull
@Override
public String getLabel()
{
return label;
}
public String getDescription()
{
return description;
}
@Override
public String toString() {
return id;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.dashboard.registry;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import java.util.ArrayList;
import java.util.List;
public class DashboardRegistry {
private static DashboardRegistry instance = null;
public synchronized static DashboardRegistry getInstance() {
if (instance == null) {
instance = new DashboardRegistry(Platform.getExtensionRegistry());
}
return instance;
}
private final List<DashboardDescriptor> descriptors = new ArrayList<>();
private DashboardRegistry(IExtensionRegistry registry) {
// Load data descriptors from external plugins
{
IConfigurationElement[] extElements = registry.getConfigurationElementsFor(DashboardDescriptor.EXTENSION_ID);
for (IConfigurationElement ext : extElements) {
DashboardDescriptor formatterDescriptor = new DashboardDescriptor(ext);
descriptors.add(formatterDescriptor);
}
}
}
public List<DashboardDescriptor> getAllDashboards() {
return descriptors;
}
public DashboardDescriptor getDashboard(String id) {
for (DashboardDescriptor descriptor : descriptors) {
if (descriptor.getId().equals(id)) {
return descriptor;
}
}
return null;
}
public List<DashboardDescriptor> getDashboard(DBPDataSourceContainer dataSourceContainer) {
List<DashboardDescriptor> result = new ArrayList<>();
return result;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.dashboard.view;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.IDataSourceContainerProvider;
import org.jkiss.utils.CommonUtils;
public class DashboardView extends ViewPart implements IDataSourceContainerProvider {
public static final String VIEW_ID = "org.jkiss.dbeaver.ui.dashboardView";
public DashboardView()
{
super();
}
@Override
public void createPartControl(Composite parent)
{
//UIUtils.setHelp(parent, IHelpContextIds.CTX_DATABASE_NAVIGATOR);
String secondaryId = getViewSite().getSecondaryId();
if (!CommonUtils.isEmpty(secondaryId)) {
/*
try {
DBNNode node = getNodeFromSecondaryId(secondaryId);
setPartName(node.getNodeName());
setTitleImage(DBeaverIcons.getImage(node.getNodeIconDefault()));
} catch (DBException e) {
// ignore
}
*/
}
}
@Override
public void setFocus() {
}
@Override
public void init(IViewSite site) throws PartInitException {
super.init(site);
}
@Override
public void saveState(IMemento memento) {
super.saveState(memento);
}
@Override
public DBPDataSourceContainer getDataSourceContainer() {
return null;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ui.dashboard.view;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
import java.util.Map;
public class HandlerDashboardOpen extends AbstractHandler implements IElementUpdater {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
return null;
}
@Override
public void updateElement(UIElement element, Map parameters)
{
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册