From 55ea54607d1458b457a23988911c65581f80a388 Mon Sep 17 00:00:00 2001 From: "kh5325.kim" Date: Thu, 5 Sep 2013 11:48:23 +0900 Subject: [PATCH] Added IWorkbenchAdapter for properties --- org.tizen.common.connection/plugin.xml | 12 ++--- .../tizen/common/connection/ConnectionPlugin.java | 19 ++++--- .../tizen/common/connection/FileEntryAdapter.java | 58 ++++++++++++++++++++++ .../common/connection/FileEntryAdapterFactory.java | 53 ++++++++++++++++++++ 4 files changed, 128 insertions(+), 14 deletions(-) create mode 100644 org.tizen.common.connection/src/org/tizen/common/connection/FileEntryAdapter.java create mode 100644 org.tizen.common.connection/src/org/tizen/common/connection/FileEntryAdapterFactory.java diff --git a/org.tizen.common.connection/plugin.xml b/org.tizen.common.connection/plugin.xml index bc93d12..639cffd 100644 --- a/org.tizen.common.connection/plugin.xml +++ b/org.tizen.common.connection/plugin.xml @@ -122,12 +122,12 @@ nameFilter="*" objectClass="org.tizen.sdblib.service.FileEntry"> - + + * Hyunsik Noh + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.common.connection; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.model.IWorkbenchAdapter; +import org.tizen.sdblib.service.FileEntry; + +/** + * The Adapter class for providing the properties. + */ +public class FileEntryAdapter implements IWorkbenchAdapter { + @Override + public Object[] getChildren(Object o) { + return null; + } + + @Override + public ImageDescriptor getImageDescriptor(Object object) { + return null; + } + + @Override + public String getLabel(Object o) { + if (o instanceof FileEntry) + return ((FileEntry) o).getName(); + return null; + } + + @Override + public Object getParent(Object o) { + return null; + } +} diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/FileEntryAdapterFactory.java b/org.tizen.common.connection/src/org/tizen/common/connection/FileEntryAdapterFactory.java new file mode 100644 index 0000000..772c770 --- /dev/null +++ b/org.tizen.common.connection/src/org/tizen/common/connection/FileEntryAdapterFactory.java @@ -0,0 +1,53 @@ +/* + * Common + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Hoon Kang + * Hyunsik Noh + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.common.connection; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.ui.model.IWorkbenchAdapter; +import org.tizen.sdblib.service.FileEntry; + +/** + * The AdapterFactory class for providing the properties. + */ +public class FileEntryAdapterFactory implements IAdapterFactory { + private Object fileEntryAdapter = new FileEntryAdapter(); + + @Override + public Object getAdapter(Object adaptableObject, Class adapterType) { + if (adapterType == IWorkbenchAdapter.class) { + if (adaptableObject instanceof FileEntry) { + return fileEntryAdapter; + } + } + return null; + } + + @Override + public Class[] getAdapterList() { + return new Class[] { IWorkbenchAdapter.class }; + } +} -- 2.7.4