Merge change 26773 into eclair
* changes: Disable clipping toggle when not supported.
This commit is contained in:
@@ -41,7 +41,6 @@ import com.android.layoutlib.api.ILayoutResult;
|
||||
import com.android.layoutlib.api.IProjectCallback;
|
||||
import com.android.layoutlib.api.IResourceValue;
|
||||
import com.android.layoutlib.api.IXmlPullParser;
|
||||
import com.android.layoutlib.api.ILayoutResult.ILayoutViewInfo;
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
@@ -76,7 +75,6 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -484,7 +482,6 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
||||
// to trigger the edit of the new file.
|
||||
res.refreshLocal(IResource.DEPTH_INFINITE, new IProgressMonitor() {
|
||||
public void done() {
|
||||
mConfigComposite.setConfig(config);
|
||||
mConfigComposite.getDisplay().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
onConfigurationChange();
|
||||
@@ -970,6 +967,19 @@ public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutE
|
||||
}
|
||||
}
|
||||
|
||||
public void reloadConfigurationUi() {
|
||||
// enable the clipping button if it's supported.
|
||||
Sdk currentSdk = Sdk.getCurrent();
|
||||
if (currentSdk != null) {
|
||||
IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());
|
||||
AndroidTargetData data = currentSdk.getTargetData(target);
|
||||
if (data != null) {
|
||||
LayoutBridge bridge = data.getLayoutBridge();
|
||||
mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by LayoutEditor.UiEditorActions.selectUiNode to select a new UI Node
|
||||
* created by {@link ElementCreateCommand#execute()}.
|
||||
|
||||
@@ -547,6 +547,8 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
||||
// enable the create button if the current and edited config are not equals
|
||||
mConfigComposite.setEnabledCreate(
|
||||
mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);
|
||||
|
||||
reloadConfigurationUi();
|
||||
}
|
||||
|
||||
public Rectangle getBounds() {
|
||||
@@ -728,7 +730,18 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
||||
PaletteFactory.createPaletteRoot(mPaletteRoot, mLayoutEditor.getTargetData());
|
||||
}
|
||||
|
||||
|
||||
public void reloadConfigurationUi() {
|
||||
// enable the clipping button if it's supported.
|
||||
Sdk currentSdk = Sdk.getCurrent();
|
||||
if (currentSdk != null) {
|
||||
IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());
|
||||
AndroidTargetData data = currentSdk.getTargetData(target);
|
||||
if (data != null) {
|
||||
LayoutBridge bridge = data.getLayoutBridge();
|
||||
mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks for a file matching the new {@link FolderConfiguration} and attempts to open it.
|
||||
@@ -1231,7 +1244,6 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
||||
// to trigger the edit of the new file.
|
||||
res.refreshLocal(IResource.DEPTH_INFINITE, new IProgressMonitor() {
|
||||
public void done() {
|
||||
mConfigComposite.setConfig(config);
|
||||
mParent.getDisplay().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
onConfigurationChange();
|
||||
|
||||
@@ -82,4 +82,6 @@ import org.eclipse.ui.IEditorPart;
|
||||
|
||||
abstract Clipboard getClipboard();
|
||||
|
||||
abstract void reloadConfigurationUi();
|
||||
|
||||
}
|
||||
|
||||
@@ -410,6 +410,7 @@ public class LayoutEditor extends AndroidEditor implements IShowEditorInput, IPa
|
||||
if (mGraphicalEditor != null) {
|
||||
mGraphicalEditor.reloadEditor();
|
||||
mGraphicalEditor.reloadPalette();
|
||||
mGraphicalEditor.reloadConfigurationUi();
|
||||
mGraphicalEditor.recomputeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,11 +227,6 @@ public class ConfigurationComposite extends Composite {
|
||||
onDeviceConfigChange();
|
||||
}
|
||||
|
||||
public void setConfig(FolderConfiguration config) {
|
||||
// mCurrentConfig.set(config);
|
||||
throw new UnsupportedOperationException("setConfig");
|
||||
}
|
||||
|
||||
public FolderConfiguration getCurrentConfig() {
|
||||
return mCurrentConfig;
|
||||
}
|
||||
@@ -429,6 +424,17 @@ public class ConfigurationComposite extends Composite {
|
||||
mCreateButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public void setClippingSupport(boolean b) {
|
||||
mClippingButton.setEnabled(b);
|
||||
if (b) {
|
||||
mClippingButton.setToolTipText("Toggles screen clipping on/off");
|
||||
} else {
|
||||
mClipping = true;
|
||||
mClippingButton.setSelection(true);
|
||||
mClippingButton.setToolTipText("Non clipped rendering is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the UI controls state with a given {@link FolderConfiguration}.
|
||||
* <p/>If <var>force</var> is set to <code>true</code> the UI will be changed to exactly reflect
|
||||
@@ -596,5 +602,4 @@ public class ConfigurationComposite extends Composite {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user