提交 b58c6b3d 编写于 作者: J jurgen

Code cleanup

上级 a9f69088
......@@ -30,9 +30,6 @@ import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSWrapper;
import org.jkiss.dbeaver.registry.editor.EntityEditorsRegistry;
import org.jkiss.dbeaver.ui.ActionUtils;
import org.jkiss.dbeaver.ui.dnd.TreeNodeTransfer;
import java.util.Collection;
/**
* ObjectPropertyTester
......@@ -68,13 +65,13 @@ public class ObjectPropertyTester extends PropertyTester
if (property.equals(PROP_CAN_OPEN)) {
return node.isPersisted();
} else if (property.equals(PROP_CAN_CREATE) || property.equals(PROP_CAN_PASTE)) {
Class objectType = null;
Class objectType;
if (!(node instanceof DBNContainer)) {
if (node.getParentNode() instanceof DBNContainer) {
node = node.getParentNode();
}
}
DBNContainer container = null;
DBNContainer container;
if (node instanceof DBNContainer) {
// Try to detect child type
objectType = ((DBNContainer)node).getChildrenClass();
......@@ -143,9 +140,9 @@ public class ObjectPropertyTester extends PropertyTester
if (node instanceof DBNDatabaseNode) {
DBSObject object = ((DBNDatabaseNode)node).getObject();
return
object != null &&
!isReadOnly(object) &&
node.getParentNode() instanceof DBNContainer &&
object != null &&
getObjectManager(object.getClass(), DBEObjectRenamer.class) != null;
}
} else if (property.equals(PROP_CAN_FILTER)) {
......@@ -165,7 +162,7 @@ public class ObjectPropertyTester extends PropertyTester
return dataSource == null || dataSource.getContainer().isConnectionReadOnly();
}
private static <T extends DBEObjectManager> T getObjectManager(Class objectType, Class<T> managerType)
private static <T extends DBEObjectManager> T getObjectManager(Class<?> objectType, Class<T> managerType)
{
return EntityEditorsRegistry.getInstance().getObjectManager(objectType, managerType);
}
......
......@@ -19,14 +19,7 @@ package org.jkiss.dbeaver.ui.preferences;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jkiss.dbeaver.model.DBPPreferenceListener;
import org.jkiss.dbeaver.model.DBPPreferenceStore;
import java.io.IOException;
......@@ -38,6 +31,7 @@ public class PreferenceStoreDelegate implements IPreferenceStore, IPersistentPre
{
private final DBPPreferenceStore delegate;
/*
private static class PropertyChangeListenerDelegate implements IPropertyChangeListener {
private final DBPPreferenceListener delegate;
......@@ -56,6 +50,7 @@ public class PreferenceStoreDelegate implements IPreferenceStore, IPersistentPre
));
}
}
*/
public PreferenceStoreDelegate(DBPPreferenceStore delegate) {
this.delegate = delegate;
......
......@@ -17,7 +17,6 @@
*/
package org.jkiss.dbeaver.ui.properties;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IFilter;
import org.jkiss.dbeaver.DBeaverPreferences;
import org.jkiss.dbeaver.core.DBeaverCore;
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ui.properties;
import org.eclipse.jface.viewers.LabelProvider;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
/**
* Label provider for property sources
*/
public class DefaultPropertyLabelProvider extends LabelProvider
{
public static final DefaultPropertyLabelProvider INSTANCE = new DefaultPropertyLabelProvider();
@Override
public String getText(Object element)
{
return RuntimeUtils.makeDisplayString(element).toString();
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ui.properties;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
/**
* Property source listener
*/
public interface IPropertySourceListener {
void handlePropertyChange(Object editableValue, IPropertyDescriptor prop, Object value);
}
......@@ -21,7 +21,6 @@ import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
import org.jkiss.dbeaver.model.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.DBPPropertySource;
import org.jkiss.dbeaver.ui.UIUtils;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册